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

st: RE: Re: RE: Re: Re: Re: RE: Re: panel data command


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Re: RE: Re: Re: Re: RE: Re: panel data command
Date   Thu, 29 Jul 2004 00:02:51 +0100

The FAQ at http://www.stata.com/support/faqs/data/reshape3.html
does tell you. Here are some sample extracts. 

reshape works with stubnames

A key point to be grasped is that in reshaping from wide to long, 
reshape expects to find one or more groups of variables such that 
names in each group all begin with the same stubname. Thus, the 
variable names inc60, inc70, inc80, and inc90 all share the stubname 
inc. 

The syntax diagram for the command in the manual and in the on-line 
help gives patterns for the so-called basic syntax (setting aside the options) of 

  reshape wide varnames
  reshape long varnames

but it may help to read this as 

  reshape wide stubnames
  reshape long stubnames

Thus, in the example above, the stubname would be inc. If we also have 
variables pop60, pop70, pop80, and pop90, then pop would be an extra stubname. 

Suffixes should be numeric unless specified otherwise with string

Moreover, reshape expects that what follows the stub - the suffix - 
will be numeric, unless you specify otherwise with the string option. 
Any non-numeric characters may mess things up if you overlook this 
rule, including not only letters, but also the _ (underscore), which 
you might be using in your variable names. 

Nick 
[email protected] 

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of is300gp
> Sent: 28 July 2004 23:59
> To: [email protected]
> Subject: st: Re: RE: Re: Re: Re: RE: Re: panel data command
> 
> 
> sorry, I did take a look, but the online help doesn't give me 
> the answer,
> neither the FAQ. I'll try to figure out.
> 
> 
> ----- Original Message ----- 
> From: "Nick Cox" <[email protected]>
> To: <[email protected]>
> Sent: Wednesday, July 28, 2004 3:34 PM
> Subject: st: RE: Re: Re: Re: RE: Re: panel data command
> 
> 
> > Now come on please. There is on-line help
> > on -reshape-. There are FAQs on -reshape-.
> > Possibly, you have access to the manual
> > and thus [R] reshape. All these give
> > answers.
> >
> > Sorry, but your question is not an
> > appropriate use of Statalist. Please
> > learn to help yourself first.
> >
> > Nick
> > [email protected]
> >
> > > -----Original Message-----
> > > From: [email protected]
> > > [mailto:[email protected]]On Behalf Of is300gp
> > > Sent: 28 July 2004 23:32
> > > To: [email protected]
> > > Subject: st: Re: Re: Re: RE: Re: panel data command
> > >
> > >
> > > So for reshape to work, all the to-be-reshaped variables got
> > > to have the
> > > same prefix, e.g. part or wage and time is automatically 
> determined by
> > > stata, is this correct? then what are the acceptable suffix,
> > > is part1 and
> > > partt acceptable?
> > >
> > > Thanks.
> > >
> > > Gang
> > > ----- Original Message ----- 
> > > From: "Michael Blasnik" <[email protected]>
> > > To: <[email protected]>
> > > Sent: Wednesday, July 28, 2004 2:52 PM
> > > Subject: st: Re: Re: RE: Re: panel data command
> > >
> > >
> > > > reshape long part wage, i(id) j(time)
> > > >
> > > > After you see the power of reshape (and many other Stata
> > > features), you
> > > > probably will want to rethink how much you want to use
> > > Excel in managing,
> > > or
> > > > working with, data  ;)
> > > >
> > > > Michael Blasnik
> > > > [email protected]
> > > >
> > > > ----- Original Message ----- 
> > > > From: "is300gp" <[email protected]>
> > > > To: <[email protected]>
> > > > Sent: Wednesday, July 28, 2004 5:42 PM
> > > > Subject: st: Re: RE: Re: panel data command
> > > >
> > > >
> > > > > 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
> > > > >
> > > > >
> > > >
> > > >
> > > > *
> > > > *   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/
> > >
> >
> > *
> > *   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/
> 

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