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

st: Re: RE: Re: panel data command


From   "is300gp" <[email protected]>
To   <[email protected]>
Subject   st: Re: RE: Re: panel data command
Date   Wed, 28 Jul 2004 14:42:24 -0700

Thanks a lot, both of these work. Great!

If you two don't mind, I'd like to ask a related question: how to convert
the matched cross sectional data into standard panel in stata?

I used to do this in excel as well, and everytime I change the varaible
list, I have to change the code in excel, very tedious.

Say, I used id to match two datasets from two period, I have id, part1, and
wage1 in data set one, and id, part2 and wage2 in dataset 2; after the
matching, I have id,  part1, wage1, part2 and wage2 as a cross-sectional
dataset, then from here, what should I do to convert this format into the
standard two year panel stata format? Thanks.


Gang




----- Original Message ----- 
From: "Nick Cox" <[email protected]>
To: <[email protected]>
Sent: Wednesday, July 28, 2004 2:17 PM
Subject: st: RE: Re: panel data command


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

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