Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: saving space while recoding


From   sarah plank <[email protected]>
To   [email protected]
Subject   st: saving space while recoding
Date   Sat, 24 Jul 2010 16:22:05 -0500

I need to create a recode but save some space in my code.   I have
lots of recodes where I am given the variable to recode and the cutoff
point over which to recode the variables.  So, given my list of
"polyclor 23.4    polyclor2  33.3  pavol 45  genpt  1.11  gnpt  1  on
0  offon 0  offon2 1  got5  66  {+ 670 more items}"  I need to recode
them all by their cutoff in the list, so

clonevar polyclor2 = polyclornew
replace polyclornew = -1 if polychlornew<44
replace polyclornew = 0 if polyclornew==45
replace polyclornew = 1 if polyclornew>46 & polyclornew!=.
tab polyclornew

but this is so exhausting for so many values and so long in the
do-code.  How can I make this in less space ?

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index