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

st: Re: panel data command


From   "R.E. De Hoyos" <[email protected]>
To   <[email protected]>
Subject   st: Re: panel data command
Date   Wed, 28 Jul 2004 21:32:38 +0100

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.

I hope this helps,

Rafa

----- Original Message -----
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?
>
> Thanks,
>
> Gang
>
> *
> *   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