Statalist The Stata Listserver


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

RE: st: < and > operand in recode


From   "b. water" <barleywater@hotmail.com>
To   "Dick Campbell" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: < and > operand in recode
Date   Mon, 21 Aug 2006 11:04:08 +0000

thanks dick for your pointers about recode dangers. following [R] recode, the included example did append a generate newvar. i think, as you warned, generating a new variable is a good practice as was tabulating against original, representing safety mechanisms should the recode produced unexpected results.

i should say that i have Stata 8 while, i think, [D] was only initiated from Stata 9 (either that or I have misplaced my [D]).

regards,
bw


----------------------------------------
> Date: Sun, 20 Aug 2006 12:10:49 -0500
> To: statalist@hsphsun2.harvard.edu
> From: dcamp@uic.edu
> Subject: Re: st: < and > operand in recode
> 
> I was in the midst of posting a response to this query when Nick Cox's very
> complete answer arrived. Just two additional points. The full documentation 
> for recode can be found in [D}, data management.
> The key idea is that recode rules are evaluated left to right. Thus 
> (1/5=1)(5/10=2) results in a value of 5 being recoded
> to 1 even though "5" appears in both rules. Nick is certainly right; 
> recoding continous variables can sometimes
> result in unexpected outcomes. At the very least, it is a good idea to 
> always use the -gen- option with recode rather than
> overwrite the original variable and to immediately cross tabulate the 
> original variable against the new.
> 
> 
> Richard T. Campbell
> Professor
> Division of Epidemiology and Biostatistics
> School of Public Health &
>    Institute for Health Research and Policy
> University of Illinois at Chicago 
> 
> 
> *
> *   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/

_________________________________________________________________
Try Live.com - your fast, personalized homepage with all the things you care about in one place.
http://www.live.com/getstarted
*
*   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