Statalist


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

st: replace a varlist to missing values for some observations


From   Sergi VIDAL TORRE <sergi.vidal@upf.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: replace a varlist to missing values for some observations
Date   Thu, 3 Sep 2009 17:47:34 +0200 (CEST)

Dear all,

I want to erase the information of my dataset for some individuals and only for a set of variables. 

I identified the individuals in a dummy var (zuwpre) and I used 'foreach' to a varlist as follows: 

gen zuwpre= 1 if fallnum>10000 & f1_dispos==1003
foreach c of varlist   f3_dispos- f3_elthaus {
	replace `c'=.  if zuwpre== 1
	}
drop zuwpre

However, I get an error message because I have some string variables in the varlist. Can anyone help me to improve this sintaxis to solve the error.

Thanks in advance!

*
*   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   |   What's new   |   Site index