Statalist The Stata Listserver


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

Re: st: RE: rearrange variables in a panel


From   "Alessandro Fiaschi" <[email protected]>
To   [email protected]
Subject   Re: st: RE: rearrange variables in a panel
Date   Mon, 6 Nov 2006 10:33:09 +0100

Even if I add an "id (=1,2,3,...)" for each firm, "gsort id -time"
makes only an order, but it doesn't rearrange data in the inverse
order (from 2005 to 1993, in my case). Could you help me more? Thanks!

Alex



2006/11/6, Maarten Buis <[email protected]>:
Alessandro:
If you have a variable that identifies the individuals/countries/firms called id, than you could
type -gsort id -time- Then you could type -drop if time <=1996- to drop the observations
from 1996 and before.
HTH,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Alessandro Fiaschi
Sent: maandag 6 november 2006 9:48
To: [email protected]
Subject: st: rearrange variables in a panel

Dear friends and collegues, I have a Panel of this kind:

time  var1 var2  var3 var4
1993 10 10 10 6
1994 12 11 12 7
1995 14 13 13 7
1996 14 13 12 8
1997 15 14 14 10
1998 11 11 11 10
1999 10 10 10 9
2000 10 8 9 9
2001 8 7 7 9
2002 10 9 9 9
2003 11 9 9 9
2004 11 9 9 11
2005 16 13 14 10
1993  -  -  12  -
1994
1995 11  -  -  -
1996 2 2 2 1
1997 6 3 2 6
1998 7 6 6 6
1999 8 7 7 8
2000 7 5 6 8
2001 10 9 9 10
2002 10 6 5 8
2003 9 7 7 11
2004 10 9 8 10
2005 9 7 7 11


I need to rearrange these data from 2005 to 1993 (I mean the inverse
order), preserving the correspondence of time series variables. At
same time, I would drop 1993, 1994 and 1996 years from the panel.
Could somebody help me? Thank you in advance.



*
*   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/

*
*   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