Hi,
I have several variables in model. I want to write a loop where it can add one variable in each turn.
Say I've variables, var1 to var20. First I want to use var1 iny regression, then var1and var2.
I wrote the following loop. But this only adds one variable in each regression.
Appreciate your help.
Thank you.
I have several variables in model. I want to write a loop where it can add one variable in each turn.
Say I've variables, var1 to var20. First I want to use var1 iny regression, then var1and var2.
I wrote the following loop. But this only adds one variable in each regression.
Code:
foreach var of varlist var1 - var20{ reg Y X `var' }
Appreciate your help.
Thank you.
Comment