Statalist The Stata Listserver


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

st: RE: Ignoring a reshape error


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Ignoring a reshape error
Date   Mon, 15 May 2006 15:09:06 +0100

I can't see what lies behind this. 

On one interpretation, -reshape- would not
proceed because it detected what are in 
fact errors in your dataset, which you
corrected interactively. Once that is 
done once it shouldn't need to be done
again. 

There is a -capture- command that eats 
an error and allows Stata to proceed. 
However, on the face of it, -reshape- 
errors are indicative of some problem,
either with the data or with your understanding 
of it, and I wouldn't go down the road of 
trying to automate working around them. 

Nick 
[email protected] 

James Fagg
 
> I need to reshape from long to wide format, and have the 
> following code 
> and error.
> 
> reshape wide hid  ypsex yptlkm yptlkf yparg* wave ypest*  , 
> i(pid) j(age12)
> 
> //age12 not unique within pid; there are multiple observations at the 
> same age12 within pid.Type "reshape error" for a listing of 
> the problem 
> observations.
> 
> The following code sorts this out so that the reshape command 
> works but 
> I have to run the program up to the first reshape command and 
> then run 
> this code and on with the program. My question is, how do I 
> write this 
> sequence so that the error message is ignored by the program and 
> rectified afterwards by the code below automatically? Simply 
> replacing 
> the relevant values before using any reshape command doesn't seem to 
> work, i.e.replace age12...reshape wide..
> 
> reshape error
> replace age12 = 13 in 6749
> replace age12 = 14 in 6750
> replace age12 = 15 in 6751
> replace age12 = 12 in 9517
> replace age12 = 12 in 10055
> replace age12 = 11 in 10055
> replace age12 = 12 in 10055
> replace age12 = 13 in 10056
> replace age12 = 14 in 10057
> reshape error
> reshape wide hid  ypsex yptlkm yptlkf yparg* wave ypest*  , 
> i(pid) j(age12)

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