| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: RE: Ignoring a reshape error
Dear Nick,
Thanks for your help with this. I understand your point about the errors
in the dataset, they are errors, but can be resolved interactively.
However, I want to be able to run the code totally automatically as I
have the same raw data in two separate locations and this data may
change periodically. Thus I wanted to be able to ensure that any changes
that I made were made in the programme and not interactively so that, if
I need to, I can go back and re-run the data management part of the
programme on a changed raw dataset without worrying that I have missed
some early changes out.
Again, thanks for your help.
Best
Jamie
Nick Cox wrote:
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/
*
* 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/