Hello, I am interested in creating a variable "yes" that takes 1 for each "id" in "year" = 2002,2003,2004, 2005, 2006 and 0 otherwise.
bys id: gen yes = 1 if year == 2002&2003&2004&2005&2006 --> this does not work.
I cannot proceed with reshape command, as I have 10,000 observations.
I would like variable "yes" that looks like:
Anyone knows how to proceed?
Thanks.
bys id: gen yes = 1 if year == 2002&2003&2004&2005&2006 --> this does not work.
I cannot proceed with reshape command, as I have 10,000 observations.
I would like variable "yes" that looks like:
id | year | yes |
A | 2002 | 1 |
A | 2003 | 1 |
A | 2004 | 1 |
A | 2005 | 1 |
A | 2006 | 1 |
B | 2003 | 0 |
B | 2005 | 0 |
Thanks.
Comment