|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: loop over files, storing r(class), create new dta file
dear listers,
stata 8.2,
i am trying to write the following do-file:
use "C:\cltest\bipol1.dta", clear
metan rxd_impr rxd_noimp con_impr con_noimp, rr
//this will generate its own r(ES), the value of which i want to save
metan gen_impr gen_noimp gcon_impr gcon_noimpr, rr
//this will generate its own r(ES), the value of which i want to save
use "C:\cltest\bipol2.dta", clear
//this will generate its own r(ES), the value of which i want to save
metan gen_impr gen_noimp gcon_impr gcon_noimpr, rr
//this will generate its own r(ES), the value of which i want to save
.
.
.
.
.
use "C:\cltest\bipol38.dta", clear
metan rxd_impr rxd_noimp con_impr con_noimp, rr
//this will generate its own r(ES), the value of which i want to save
metan gen_impr gen_noimp gcon_impr gcon_noimpr, rr
//this will generate its own r(ES), the value of which i want to save
after this, what i want to accomplish is create a new datafile.dta
containing 3 variables where var1 would be a list of bipol*(i.e. bipol1,
bipol2, bipol3,..., bipol38), var2 would be a list of the 38 rxd_ES, & var3
would be, similarly, a list of 38 gen_(ES).
at the moment, i am accomplishing the task manually i.e. doing the metan one
by one and saving the r(ES) via copy/paste onto a second stata session edit
windows. i think the first bit can be accomplished using forvals or foreach
loop _N or _n, but which i don't know how, much less storing the r(ES)'s and
then generating a new *.dta as per what i wanted to do.
would appreciate advice/help.
thank you,
bw
_________________________________________________________________
Kick back and relax with hot games and cool activities at the Messenger
Caf�. http://www.cafemessenger.com?ocid=TXT_TAGHM_SeptHMtagline1
*
* 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/