Statalist The Stata Listserver

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

Re: st: Replacing several variables at once

From   "Sebastian F. Büchte" <>
Subject   Re: st: Replacing several variables at once
Date   Tue, 6 Feb 2007 13:04:59 +0100


for your special case you could try to use -mvencode- :

mvencode var1 var2 var3, mv(0)

will replace all missing values in var1, var2, var3 by 0. See also
-help mvencode-

A more general approach would be to use recode, see -help recode-


On 2/6/07, Nuno <> wrote:
Hi everyone,

I need to replace missing values by 0 for a set of about 30 variables which
are not sequencially ordered and have very different names. I'm using the
-rename- command for each variable, but this becomes a bit cumbersome and
might contain errors given the number of the variables. Plus, I'll need to
redo the same thing for other datasets. Does anyone know a way of
facilitating this task? I was wondering if -inlist- would be suitable to do
this, as it would only be necessary to define the variables once( something
like replace inlist(arlist)=0 if inlist(varlist)==.).

All the best.

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index