Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Generating Ids in a panel


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Generating Ids in a panel
Date   Mon, 21 Jan 2008 16:04:11 -0000

I am not clear what Excel is. 

Several possibilities, e.g. 

egen year = seq(), from(1976) to(1982) 
egen id = seq(), block(7) 
tsset id year 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Martin Weiss
Sent: 21 January 2008 15:59
To: [email protected]
Subject: st: Generating Ids in a panel

I am working on a panel dataset that does not (yet) contain ids and time
variables. Now that I want to xtset it, I am wondering how I can
generate a
sequence for the ids that increments after the 7th, 14th... observation?
At
the same time, I need to generate the same pattern of years for every
individual, i.e. I want to go from

UNION	ED	BLK	LWAGE
0	9	0	5.56068
0	9	0	5.72031
0	9	0	5.99645
0	9	0	5.99645
0	9	0	6.06146
0	9	0	6.17379
0	9	0	6.24417
0	11	0	6.16331
0	11	0	6.21461
1	11	0	6.2634
0	11	0	6.54391
0	11	0	6.69703
0	11	0	6.79122
0	11	0	6.81564


To 


UNION	ED	BLK	LWAGE	     id    year
0	9	0	5.56068	1	1976
0	9	0	5.72031	1	1977
0	9	0	5.99645	1	1978
0	9	0	5.99645	1	1979
0	9	0	6.06146	1	1980
0	9	0	6.17379	1	1981
0	9	0	6.24417	1	1982
0	11	0	6.16331	2	1976
0	11	0	6.21461	2	1977
1	11	0	6.2634	2	1978
0	11	0	6.54391	2	1979
0	11	0	6.69703	2	1980
0	11	0	6.79122	2	1981
0	11	0	6.81564	2	1982



Is there any utility to do this - I just used Excel which seems a little
weird given that this task seems ubiquitous...



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index