Hello everyone, I am new to Stata and need your help.
I can run the following simple regression with the attached dataset:
clear all
import excel "xyz1.xlsx", firstrow case(lower) clear
gen lxa = ln(20+xa)
reg y lxa za
In the dataset, I have the following variables:
t y xa xb xd xf za zb zd zf
I would like to repeat the regression as follows:
gen lxb = ln(20+xb)
reg y lxb zb
......
gen lxd = ln(20+xd)
reg y lxd zd
......
gen lxf = ln(20+xf)
reg y lxf zf
......
How may I write a loop over 'a', 'b', 'd', 'f' to do the above task?
Thank you very much!!
I can run the following simple regression with the attached dataset:
clear all
import excel "xyz1.xlsx", firstrow case(lower) clear
gen lxa = ln(20+xa)
reg y lxa za
In the dataset, I have the following variables:
t y xa xb xd xf za zb zd zf
I would like to repeat the regression as follows:
gen lxb = ln(20+xb)
reg y lxb zb
......
gen lxd = ln(20+xd)
reg y lxd zd
......
gen lxf = ln(20+xf)
reg y lxf zf
......
How may I write a loop over 'a', 'b', 'd', 'f' to do the above task?
Thank you very much!!
Comment