Statalist The Stata Listserver


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

st: Ignoring a reshape error


From   James Fagg <j.fagg@qmul.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: Ignoring a reshape error
Date   Mon, 15 May 2006 14:18:02 +0100

Dear List,

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)

Thanks,

Jamie
--

Department of Geography
Queen Mary, University of London
Mile End Rd,
London,
E1 4NS
Tel: 020 7882 5428

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