Statalist


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

st: foreach problem


From   "Rajesh Tharyan" <R.Tharyan@exeter.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: foreach problem
Date   Wed, 17 Sep 2008 00:32:07 +0100

Hi,

Now,  what could possibly be wrong with this?

foreach var of varlist  deco pico  {
gen abnor`var'=`var'- N`var'
sort d
by d: egen Aabnor`var'=mean(abnor'var')
}

Stata gives me

. abnor'var' invalid name
  r(198);

I have already created N`var' and I can see that it exists..

Thanks
rajesh

*
*   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