My dataset is longitudinal in the long format, and each individual has 5 rows of data with each row representing one wave (i.e. total 5 waves).
I just want to create a variable called year which can take on the same 5 values for subjects: 1982, 1989, 1999, 2009 & 2015 and is understood by Stata to be in calendar years. I will use this year variable to help create other variables like duration and age etc.
I would like the year variable to look this:
Code:
id year 1 1982 1 1989 1 1999 1 2009 1 2015 2 1982 2 1989 2 1999 2 2009 2 2015 3 1982 3 1989 3 1999 3 2009 3 2015
Many Thanks
/Amal
0 Response to Creating a year variable in a longitudinal dataset
Post a Comment