Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: recode foreach with sysmis versus dot


From   daniel klein <klein.daniel.81@gmail.com>
To   statalist@hsphsun2.harvard.edu
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index