Dear Statalist Users,

A much simplified version of my current dataset is as follows:


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double(y x1 x2)
1 3   3
3 2   1
2 2 233
1 3   2
3 1  24
2 3   3
end

I have two covariates, x1 and x2, and I wish to run a regression of x1 and x2. Although a direct loop would work in this case, I have a very large number of x variables, with a numbered suffix. Consequently, I decided to create a macro instead:



Code:
global list "x`i'" 
forvalues i = 1(1)2 {
regress y $list
}
Although intuitive, the index i is not recognized by Stata, and an error message specifying an ambiguous abbreviation is returned. I am unsure why this is the case, as `i' should be extracted from the macro (they are simple string characters after all).

Any suggestions on this conundrum are much appreciated !

- CS