Dear all,
I am using Stata version 14.2 on Windows 7 and I am trying to create a basic panel structure in Stata for 7332 individuals, which are followed for 17 time periods (1999 to 2015).
To create the time variable, I used the following code:
Now I need to create the corresponding individual unique ID. The panel structure should look like:
Does someone know a smart command how to create the ID variable starting with 1 and ending with 7332 for each 17 time periods?
How would the work with a loop command?
The aim is to use this basic structure to match several datasets (based on the variables year and unique ID).
If this questions has been addressed before, I would be happy if you could provide me with the right directions.
Thank you and best
Manuel
I am using Stata version 14.2 on Windows 7 and I am trying to create a basic panel structure in Stata for 7332 individuals, which are followed for 17 time periods (1999 to 2015).
To create the time variable, I used the following code:
Code:
set obs 124644 egen t = fill(1999 2000 to 2015 1999 2000 to 2015) format %ty t
Year | ID |
1999 | 1 |
2000 | 1 |
... | ... |
2015 | 1 |
1999 | 2 |
2000 | 2 |
... | ... |
2015 | 2 |
1999 | 3 |
2000 | 3 |
etc | etc |
How would the work with a loop command?
The aim is to use this basic structure to match several datasets (based on the variables year and unique ID).
If this questions has been addressed before, I would be happy if you could provide me with the right directions.
Thank you and best
Manuel
Comment