Hello everyone,
I would like to know what is the equivalent of last. command of SAS for stata, if the last occurrence is not a value 0 or 1.
For example I have a dataset with id and years:
id year
1 2002
2 2003
3 2004
4 2005
I would like to generate a variable called "LAST" and taking the value of 1 if the row is the last occurrence of the variable and 0 otherwise (equivalent of SAS: if last.id then last=1).
The solution given in the FAQ applies to a stata coded 1 or 0. I could not find the answer in STATA for a variable that changes but without typing the value of the variable (like done with state in the FAQ)
I thank you in advance for your help !!!
Kindly,
Eugénie
I would like to know what is the equivalent of last. command of SAS for stata, if the last occurrence is not a value 0 or 1.
For example I have a dataset with id and years:
id year
1 2002
2 2003
3 2004
4 2005
I would like to generate a variable called "LAST" and taking the value of 1 if the row is the last occurrence of the variable and 0 otherwise (equivalent of SAS: if last.id then last=1).
The solution given in the FAQ applies to a stata coded 1 or 0. I could not find the answer in STATA for a variable that changes but without typing the value of the variable (like done with state in the FAQ)
I thank you in advance for your help !!!
Kindly,
Eugénie
Comment