Statalist The Stata Listserver


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

st: Inexplicable errors when using -reshape long-


From   Clive Nicholas <crazeeclive@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: Inexplicable errors when using -reshape long-
Date   Sun, 18 Feb 2007 09:57:59 +0000 (GMT)

I wonder if anyone can help on this.

Following the example given in -help reshape- when converting one's data from wide to long format, thus

(wide form)                                                   
i     .............. x_ij ...............
id   sex  inc80   inc81   inc82
------------------------------------------
1    0     5000    5500    6000
2    1     2000    2200    3300
3    0     3000    2000    1000

(long form)      
i     j             x_ij
id   year   sex    inc 
-------------------------------
1    80      0       5000 
1    81      0       5500 
1    82      0       6000 
2    80      1       2000 
2    81      1       2200 
2    82      1       3300 
3    80      0       3000 
3    81      0       2000 
3    82      0       1000 

The help file clearly states that the above is achieved by

. reshape long inc, i(id) j(year)

But I can't reproduce this simple command with my own data, and I _don't_ understand why!

. des

Contains data from bepsnew2.dta
  obs:         3,615                          
 vars:            13                          18 Feb 2007 02:54
 size:        65,070 (99.8% of memory free)
-------------------------------------------------------------------------------
              storage  display     value
variable name   type   format      label      variable label
-------------------------------------------------------------------------------
id              int    %9.0g                  
rsex01          byte   %8.0g       rsex01     Female voter
conle98         byte   %8.0g                  votelc98==conservative
lable98         byte   %8.0g                  votelc98==labour
ldmle98         byte   %8.0g                  votelc98==liberal democrat
othle98         byte   %9.0g                  
conle99         byte   %8.0g                  votelc99==conservative
lable99         byte   %8.0g                  votelc99==labour
ldmle99         byte   %8.0g                  votelc99==liberal democrat
othle99         byte   %9.0g                  
conle00         byte   %8.0g                  votelc00==conservative
lable00         byte   %8.0g                  votelc00==labour
ldmle00         byte   %8.0g                  votelc00==liberal democrat
othle00         byte   %9.0g                  
-------------------------------------------------------------------------------

All of the data here (recalculated from the 1997-2001 British Election Panel Study) - apart from the sex variable - are dummy variables arrayed in wide format over three waves, with quite a few missings on some of them. The year is clearly indicated at the end of each variable, apart from the -id- variable. This is a snapshot of the data I need to -reshape-: there are also variables indicating survey answers to questions asked on only two waves. Every time I run -reshape- to convert to long, I get this:

. reshape long conle98-othle00, i(id) j(year)
no xij variables found
r(111);

. reshape long rsex01 conle98-othle00, i(id) j(year)
no xij variables found
r(111);

This ought to be very straightforward, but I can't go any further with this, so any help would be greatly appreciated.

Clive Nicholas




		
___________________________________________________________ 
Copy addresses and emails from any email account to Yahoo! Mail - quick, easy and free. http://uk.docs.yahoo.com/trueswitch2.html

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