Dear ,
I want to transform my dataset into panel dataset.
Currently my dataset looks like this (first 5 lines)
id start3 end3
1 12jul1983 01jan1985
2 01jan1983 31dec2013
3 01jan1985 31dec2013
4 01jan1989 01jan1999
I want it to transform to:
id start3. end3 year
1 12jul1977 01jan1985 1983
1 12jul1977 01jan1985 1984
1 12jul1977 01jan1985 1985
2 01jan1983 31dec2013 1983
2 01jan1983 31dec2013 1984
2 01jan1983 31dec2013 1985
....
2 01jan1983 31dec2013 2013
and so on with a new variable year (or equivalent time variable that adds up for each year an item is still being observed)
I have tried several ways using 'expand' in combination with 'bysort', _n commands, but I can't reach the desired result.
Can someone please advise me on this?
best wishes
Kutsal Yesilkagit
Related Posts with expanding single observation into panel data with observations for each year an item exists
How to add value label to default missing values?Hi there, Sorry for a really beginner question. I am trying to add value labels to organise my data…
-meprobit- vs -probit- with clustered standard errorsHi all, So I have a multi-level data, with individuals from different countries, over the period of …
Replacing observations with charachtersI am using the following command: gen Cou_Code_O=. in 1/26 replace Cou_Code_O = "ARG" in 1 and …
Using stir to analyse IRR for cancer recurrence in two groups, p significant but CI range below 1, any thoughts?Dear all, I have a set of data with approximately 100 patiens treated for cancer in two groups in r…
Creating a subsample with missing value restrictionsDear all From the entire sample list ,I would like to create a sub-sample based on certain condtions…
Subscribe to:
Post Comments (Atom)
0 Response to expanding single observation into panel data with observations for each year an item exists
Post a Comment