I am writing a program that looks like:
However, if I have two variables in the `flist', then I would not close myfile, and want to add
Thus, the process should continue where the two lines are added for each additional variable in the `flist'. Right now I am using if statement, but cannot generlize it and cannot predict how many variables a user will add to the `flist'
:
prog def asp syntax varlist [if] [in], flist(varlist) tokenize `flist' file open myfile using "File.csv", write replace reg `varlist' `flist' if `touse' file write myfile ",Coefficients of `1', t(`1') " _n file write myfile ", _b[`1'], _b[`1']/_se[`1']" _n file close myfile end
:
file write myfile ",Coefficients of `2', t(`2') " _n file write myfile ", _b[`2'], _b[`2']/_se[`2']" _n file close myfile end