I wish to write a program that can be applied to multiple scenarios. For example, consider the following program
Code:
*Program name - P1
capture program drop P1
program P1
eststo clear
timer clear
forvalues i=1(1)3{
timer on `i'
quietly reg pv1math lbe ${reg`i'}
timer off `i'
timer list
estadd scalar R = r(t`i')
eststo Model`i'
end
}However, I wish to have the ability to estimate multiple models with this program by changing only the line:
Code:
quietly reg pv1math lbe ${reg`i'}Code:
Program P1
quietly reg pv1math lbe ${reg`i'}Code:
Program P1
quietly mixed pv1math lbe ${reg`i'}, || country: || schoolid:Code:
Program P1
quietly mixed numscore1 lbe ${reg`i'} [pw=w_fstuwt] || schoolid: || country:, nologIf you are thinking about loops that require running all the regressions each time I want to estimate a single line then it is not a good idea. I need to be able to run the each of the regressions separately.
Thanks ahead (@Nick?)
0 Response to Writing a program with specific line alternating
Post a Comment