Statalist The Stata Listserver


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

st: RE: Data loss with -reshape-


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: RE: Data loss with -reshape-
Date   Thu, 19 Oct 2006 15:14:07 -0500

No your not losing data (well, except for dropping foreign) but merely
separating price into two variables where price0 will be missing if foreign
== 1 and price1 will be missing if foreign == 0

You could accomplish the same thing with:
 sysuse auto, clear
 separate price, by(fore)
 count if price1==.
 count if price0==.

Scott


> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of dferry
> Sent: Thursday, October 19, 2006 2:57 PM
> To: StataList
> Subject: st: Data loss with -reshape-
> 
> Dear Statalisters,
> I seem to be losing data with -reshape-. This has never happened to me
> before. Am I just being a total idiot? (I am running the most recent
> version of Stata 9 SE on a Win XP box, and yes, I rebooted).
> 
> . sysuse auto, clear
> (1978 Automobile Data)
> 
> . count if price==.
>     0
> 
> . reshape wide price, i(make) j(foreign)
> (note: j = 0 1)
> 
> Data                               long   ->   wide
> --------------------------------------------------------------------------
> ---
> Number of obs.                       74   ->      74
> Number of variables                  12   ->      12
> j variable (2 values)           foreign   ->   (dropped)
> xij variables:
>                                   price   ->   price0 price1
> --------------------------------------------------------------------------
> ---
> 
> . count if price1==.
>    52
> 
> . count if price0==.
>    22
> 


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