I am trying to write a program in Stata. The goal of the program is to loop through a varlist. I have my code below and some notes about the program. I am running Stata version 7.
I would appreciate any help.
Laura
Code:
local pain arthralgia_pain back_pain headache_pain autoimmune_pain other_msk_pain fibro_pain inflam_pain neuro_pain program table_outargs i j varlist describe `varlist', varlist // this step is part of troubleshooting. Only headache is displayed di `i' // this is fine di `j' // this is fine di `varlist' //nothing display foreach var of local `varlist' { local j = `j' + 1 local i = `i' + 1 di `var' // a period is displayed }end quietly describe `pain', varlist table_out `i' `j' `pain'
Laura
Comment