I am struggling with imposing if condition on a inner loop. Consider the following example where a user can input five dependent variables with names S1 S2 S3 S4 S5 or S1H1 S1H2 S1H3 S1H4 S1H5,
let say that the user inputs the first series of dependent variables i.e. S1 S2 S3 S4 S5, then I just need the higher loop i.e.
However, if the user inputs the second series i.e., S1H1 S1H2 S1H3 S1H4 S1H5, then I need both the outer and inner loops. i.e.
Code:
local LHS : word 1 of `varlist' local S = substr("`LHS'",1,1) local H = substr("`LHS'",3,1) local NF: word count `varlist' forv s=1/`NF'{ *IF condition is required here forv h=1/`NF'{ reg `S'`s'`H'`h' `flist' } }
Code:
forv s=1/`NF'{
Code:
forv s=1/`NF'{ forv h=1/`NF'{ reg `S'`s'`H'`h' `flist' } }
Comment