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: Replace missing values by 0


From   Neil Shephard <nshephard@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Replace missing values by 0
Date   Mon, 9 Aug 2010 09:01:16 +0000

On Mon, Aug 9, 2010 at 8:55 AM, Hobst <tobias.friedli@access.uzh.ch> wrote:
> I have two variabled called "prean" and "pa_kum" that contain missing values.
> These missing values i would like to replace by 0 (zero). What command can i
> use to do this?

foreach x of varlist prean pa_kurn{
  replace `x' = 0 if(`x' == .)
}

...is one way to skin this cat.

> Thanks in advance for your support. Regards

This is a very basic question though.  You may well benefit from
reading the Users Guide and/or  taking the Stata Net Course 101 :
Introduction to Stata (see http://www.stata.com/netcourse/nc101.html).

Neil

-- 
"One should as a rule, respect public opinion in so far as is
necessary to avoid starvation and to keep out of prison, but anything
that goes beyond this is voluntary submission to an unnecessary
tyranny, and is likely to interfere with happiness in all kinds of
ways..." - Bertrand Russell

Email - nshephard@gmail.com
Website - http://slack.ser.man.ac.uk/
Photos - http://www.flickr.com/photos/slackline/
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index