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
Issue with Reshape Code: * Example generated by -dataex-. To install: ssc install dataex clear input str25 VarYr str2…
Get no. of times for loop has iteratedIs there a way that I can access the number of times a given loop is on. For example, Code: sysus…
PISA data and using country fixed effectsHello, I am working with PISA 2012 dataset and I am comparing Eastern and Western European countrie…
Working with bootstrap, program and foreachHello, I have investigated my problem and have not been able to find a solution. I would like to ca…
Loop variable values as labels in a forval line graphHi, I am trying to plot GDP for a set of countries and generate a legend which identifies each line…
Subscribe to:
Post Comments (Atom)
0 Response to Loop for many, same regressions with similar names
Post a Comment