Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Re: panel data command


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Re: panel data command
Date   Wed, 28 Jul 2004 22:17:47 +0100

Or alternatively something like 

bysort ind (t): gen part2 = 2 * part[2] + part[1] + 1 

But do note the (t) in 

bysort ind (t):

Otherwise there's a major risk of inconsistent time 
order. 


Nick 
[email protected] 

R.E. De Hoyos
> 
> Gang,
> 
> I am sure there are more elegant ways to do it, but this should work:
> 
> gen part2=.
> bys ind: replace part2=1 if  part==0 & part[_n-1]==0
> bys ind: replace part2=2 if  part==1 & part[_n-1]==0
> bys ind: replace part2=3 if  part==0 & part[_n-1]==1
> bys ind: replace part2=4 if  part==1 & part[_n-1]==1
> 
> Each individual will have only one value (1 to 4) in the 
> final year (t+1)
> and a missing value in the innitial year (t). If you want to 
> replace the
> missing values with the ones generated by part2 then you simply:
> 
> bys ind: egen part_f=mean(part2)
> 
> Notice that if have more time periods, then you would need a 
> better coding
> to account for all possible combinations.

> From: "is300gp" <[email protected]>
> To: <[email protected]>
> Sent: Wednesday, July 28, 2004 7:35 PM
> Subject: st: panel data command
> 
> 
> > Hi, dear all:
> >
> > I have simple question about data manipulation is panel 
> data:  the data is
> > in standard panel stata format,  with i = individual and t=2. the
> > participation is dummy on work participation in either 
> time; so we have
> four
> > categories of individual on work participation: those 
> participate in both
> > period, neither period, only in the first period and only 
> in the second
> > period. So my questions is how can I take out the 
> individuals falling into
> > these four categoris?
> >
> > I used to export into excel and use macro to do the job, 
> but with so many
> > time of export and inport, I'm kind of running out of gas. 
> Could anybody
> > give a better suggestion?

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