Statalist The Stata Listserver


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

RE: st: reshape


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: reshape
Date   Mon, 15 May 2006 11:36:16 +0100

This will not work without modification. 

-ds- leaves behind a varlist in memory as r(varlist). 
So Ada is correct that it may be useful for this 
purpose. Indeed, this is in large part what -ds- 
was designed to do. 

However, -reshape- takes a stublist, not a varlist. 

You must process that varlist before calling up -reshape-. 

The FAQ I quoted earlier in this thread is relevant
here. 

Nick 
n.j.cox@durham.ac.uk 

Ada Ma
 
> if you have more variables you want to reshape (X_ Y_ Z_) then those
> you don't want to reshape (id time), then you can specify:
> 
> ds id time, not
> 
> Now a list of all variables would be saved in `r(varlist)', 
> then you can write:
> 
> reshape long `r(varlist)' , i(id) j(time)

> On 5/12/06, Hans J. Baumgartner <hbaumgartner@diw.de> wrote:
> > Dear statalist,
> >
> > I would like to reshape quite a huge number of variables. 
> Is it possible
> > to use the reshape command without specifying each single 
> variable? Or can
> > I circumnavigate this problem creating a local that 
> contains all variables
> > in the data set so that I can implement the local in the 
> reshape command?
> >
> > What I am having looks something like this:
> >
> > Varnames : X_1 Y_1 Z_1        X_2 Y_2 Z_2
> >
> > reshape long X_ Y_ Z_ , i(id) j(time)
> >
> > How can I use the command without specifying X_ Y_ Z_ ?
> >

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index