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 }
Any suggestions on this conundrum are much appreciated !
- CS
0 Response to Extracting macro in a loop
Post a Comment