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!!
Related Posts with Loop for many, same regressions with similar names
Transforming a quarterly variable into a monthly variable and merging two databasesDear Statalist, I'm looking to transform a quarterly variable into a monthly variable so that it ma…
tolong: a faster reshape longtolong, a faster implementation of reshape long, is now available on ssc. Type ssc install tolong an…
Remove prefix in ID variable individual row namesI want to rename the individual rows in one column which represents the ID variable for each individ…
Cross sectional or panel dataDear Stata users, I will please like some explanation. I am working on the topic "the effect of chi…
Power analysis for conditional logistic regression with variable ratio matchingDoes anyone know how to do a power analysis for conditional logistic regression on matched case-cont…
Subscribe to:
Post Comments (Atom)
0 Response to Loop for many, same regressions with similar names
Post a Comment