I have a cross-sectional time series data set and I would like to convert
it to a data set of annual observations by assuming that the variables
remained at the same level during each five year period. (I would like to
eventually merge it with another data set)
I discovered the "expand" command but I am not quite sure how to use it.
I have something that looks like:
ID period var1 year
1 1 205 .
1 2 220 .
and would like to do something like:
expand 5
sort ID period
by ID: replace year = 1960 in 1 if period==1
by ID: replace year = year[_n-1] + 1 if missing(year)