Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: RE: RE: Problem with reshaping dataset


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: RE: Problem with reshaping dataset
Date   Thu, 7 Jun 2012 13:16:04 +0100

You really are expected to read the help carefully before you post, and study its examples, and if necessary go back and study the manual entry. That contains details on -reshape- and I (and many others) decline to explain in detail what is already very well documented. 

And your descriptions of your data and your problems are often very unclear. 

If you still need help, please show us a snapshot of what the data look like, for example a listing of the first few observations. 

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

Amal Khanolkar

Thanks - I didn't follow the help file on reshape in regards to stubnames.

If I want to change the dataset from wide to long, I should provide 'stubs of variable names'. Does this mean the stub of time variable, in this case 'year'.  And I specify a new variable variable for 'j'??

year is coded as year_1   year_2  year_3 and so on.


reshape long year, i(lopnr) j(time)

Nick Cox 

Short answer is almost certainly Yes. You didn't specify any stubnames. So, you are confusing the syntax for an initial -reshape- and that for reversing a -reshape-.

Amal Khanolkar

I'm trying to reshape a dataset from wide to long format.

The id variable is called 'lopnr'

And time is specified in years (1980 to 2000) and is called 'year'

I tried the following:

reshape long, i(lopnr) j(year)

This above doesn't work. The error I get is: 'year contains all missing values'.

Do I need to specify any other varibales after long in the command line??

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index