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
Help needed in loops for correlation analysisHi, I am using Stata 17 and need some help in my loops. Below is an example of my dataset: Code: …
nlcom followed by sureg gives error "last estimates not found"I'm trying to estimate direct and indirect effects for a logit model with multiple imputation. I ha…
Dummy based on a continuous condition. …
Predict IVProbitDear All: I am estimating the following IVProbit model: ivprobit Car_sales Car_colour Car_age (Car…
confidence intervals around proportion on multilevel dataHi, I’m doing an analysis of applications and selections for grants. I do not have a way to identif…
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