| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Date: Wed, 18 Apr 2007 10:08:42 -0500
I am mostly a sas user but use stata occasionally for analyses, particularly
if I want to do a standardization.
Below is working code to estimate a Z-standardized risk difference for the
effect of X on Y, on a subset of the dataset RDSim (where sim==1)
use "c:\datasets\RDSim\expanded.dta", clear
keep if sim == 1
sort z
by z: egen wgt=sum(n)
cs y x [fw=n], by(z) standard(wgt) rd
Id like to repeat the above program for each value of sim (from 1-50), using
efficient programming. I'd like to loop through the program 50 times for
each value of sim, but I am not proficient enough at Stata to figure out how
to do this. I tried forvalues and foreach but couldn't get either to work.
Does anybody have a simple solution to this problem they'd be willing to
share?
Thanks, Garth
Garth Rauscher
Assistant Professor
SPH Epidemiology and Biostatistics
University of Illinois at Chicago
1603 W Taylor St (M/C/ 923)
Chicago, IL 60612
(312) 413-4317 phone
(312) 996-0064 fax
[email protected] <mailto:[email protected]> email
*
* 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/