Hi,
I have to run a series of OLS regression models, each with the same dep. variable but different indep. variables.
I wanted to automate the process as follow:
1. define macros as "list1" "list2" ... (each composed as depvar indepvars)
2. using foreach
when I try to recall the lists in foreach, I have to recall macro AND inside the macro the i of foreach, as follow
$list`i'
that just doesn't work.
I even tried with local macros but the software just can't get the `i' inside the macro.
How can I automate the process?
Thank you,
Omar
I have to run a series of OLS regression models, each with the same dep. variable but different indep. variables.
I wanted to automate the process as follow:
1. define macros as "list1" "list2" ... (each composed as depvar indepvars)
2. using foreach
when I try to recall the lists in foreach, I have to recall macro AND inside the macro the i of foreach, as follow
$list`i'
that just doesn't work.
I even tried with local macros but the software just can't get the `i' inside the macro.
How can I automate the process?
HTML Code:
webuse auto global list1 price mpg rep78 trunk global list2 price mpg rep78 weight global list3 price mpg rep78 trunk weight foreach i of numlist 1/3 { regress $list`i' }
Thank you,
Omar
Comment