hello
I wonder if rangestat reg would allow for choosing in " rangestat (reg) y x " as the x specified in a variable. I hope the following example is self-explanatory.
Thanks in advance for your advice.
I wonder if rangestat reg would allow for choosing in " rangestat (reg) y x " as the x specified in a variable. I hope the following example is self-explanatory.
Code:
clear * set obs 100 gen day=_n gen y=runiform(1,10) gen x1=runiform(1,10) gen x2=runiform(1,10) gen xvar="x1" if mod(day,2)==0 replace xvar="x2" if mod(day,2)>0 rangestat (reg) y x1 , interval(day -30 -1) rename (reg_* b_* se_*) (x1reg_* x1b_* x1se_*) rangestat (reg) y x2 , interval(day -30 -1) rename (reg_* b_* se_*) (x2reg_* x2b_* x2se_*) gen reg_r2=. replace reg_r2=x1reg_r2 if xvar=="x1" replace reg_r2=x2reg_r2 if xvar=="x2" //can reg_r2 like this be obtained with one single rangestat? or any better solution?
Comment