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]

Re: st: recode foreach with sysmis versus dot


From   daniel klein <[email protected]>
To   [email protected]
Subject   Re: st: recode foreach with sysmis versus dot
Date   Mon, 24 Dec 2012 17:15:23 +0100

Also note that the loop is not necessary here, as -recode- allows a varlist.

Best
Daniel
-- 
Dear Statalist,

[...]
In a dataset I have, I need to replace zeros with "missing" for all
variables in the dataset.
[...]
<CODE>
 use auto,clear
 local variables rep78
 foreach var of varlist `variables'{
*   recode `var'(3=mis) /// fails
*   recode `var'(3=sysmiss) /// fails
*   recode `var'(3=missing) /// fails
*   recode `var'(3=`missing') /// fails
*   recode `var'(3=-9999) /// works
   recode `var'(3=.) /// works
 }
<\CODE>
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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