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
Splitting messy string varsHello, I am hoping to split up these string vars and generate binary new vars based on whether they …
Help with mergingHello, I have been working with a data set that uses NHANES data from 2003-2012. I wanted to add dat…
MaxDiff (Best-Worst ranking) Analysis in StataHi all, long time lurker here deciding to seek direct support from the experts here as I didn't find…
where does collect store its matrices?Stata 17.0 has the collect command. I wonder where does it store its intermediate and final output. …
Problems with a loop to generate new variablesHello Stata Community. I'm working in my master thesis with a data base about middle class, their v…
Subscribe to:
Post Comments (Atom)
0 Response to Loop for many, same regressions with similar names
Post a Comment