Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: further on the weighted average


From   Lee Sieswerda <Lee.Sieswerda@tbdhu.com>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: further on the weighted average
Date   Fri, 1 Aug 2003 15:05:57 -0400

The local macro is misspecified in the forvalues loop. Specify your macro
like this:
`i'
rather than like this:
'i'

Regards,

Lee Sieswerda, Epidemiologist
Thunder Bay District Health Unit
Lee.Sieswerda@tbdhu.com




-----Original Message-----
From: Yanjun Bao [mailto:ybao1@uic.edu] 
Sent: Friday, August 01, 2003 2:24 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: further on the weighted average


I wrote the following command lines accoridng to the help file.

use ki00_wgt;
egen group=group(site_id);
compress group;

gen wtmean=.;
qui forvalues i = 1/196 {;
      su po4c [w=rsp_wgt] if group == 'i';
      replace wtmean = r(p196) if group p == 'i';
};


Now I got the error message that i is an invalid name.  What should I make
of that?

Thanks,

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