Statalist The Stata Listserver


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

Re: st: Question on forvalues


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Question on forvalues
Date   Mon, 22 May 2006 20:28:12 +0100 (BST)

--- M Hollis <m73hollis_stata@yahoo.com> wrote:
> The second choice
> follows Maarten's approach, but since the entire
> variable name is invoked in the foreach line you have
> to replace the entire variable name in the subsequent
> commands, and in this case you only have to issue the
> -replace- command once since it iterates through the
> variables one at a time:
> 
> local varlist waglevl_f1989 waglevl_f1991
> waglevl_f1993 /*
>            */ waglevl_f1997 waglevl_f2000
> waglevl_m1989 /*
>            */ waglevl_m1991 waglevl_m1993
> waglevl_m1997 /*
>            */ waglevl_m2000
> 
> foreach var of varlist `varlist' {
> 	replace `var' = . if `var'<0
> }

Oops, you are right
sorry,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z214

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

Send instant messages to your online friends http://uk.messenger.yahoo.com 
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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