I have cross-sectional data for a number of years. There's a unique identifier which denotes a specific person common in each cross-section. However, new people are added each year (and some people die and are therefore not in later years)
I'd like to know how to merge these datasets in Stata to create a kind of panel.
Example:
ID X_2005 Y_2005
1 700 850
2 400 311
3 475 250
ID X_2006 Y_2006
2 425 325
3 500 250
4 465 200
I want this:
ID X_2005 Y_2005 X_2006 Y_2006
1 700 850
2 400 311 425 325
3 475 250 500 250
4 465 200
I've tried looking at Stata's merge
command but I don't understand the 1:m, m:m, etc. It also seems like the number of identifiers has to be the same in each dataset so I'm confused.