Hi there,
I am a new user here in this forum, so this is my first thread. My question:
I am trying to run the following code combining in some sense both the foreach command under a program, but dorm some reason I am not able to execute it properly. If someone can see the mistake, please let know how to solve it. Thank you in advance for you time.
program define myboot, rclass
args x
reg `x' elig esse elig_esse [aw=k_`x'] if select1==1 & esse!=0, robust
local a = _b[elig]
reg qu_m1 elig esse elig_esse [aw=k_`x'] if select1==1 & esse!=0, robust
local b = _b[elig]
return scalar ratio = a/b
end
foreach var of varlist lncn lnwr lnfoodh lnfoodout lnleisure lnotro lngasto {
bootstrap ratio_`var'=r(ratio), reps(50): myboot `var'
}
capture program drop myboot
Related Posts with Program + Foreach
Flexible Regression Specification for Panel DataDear Stata community, I am currently looking to estimate a somewhat complex regression model to ana…
Combining Cox Proportional Hazards model and Difference-in-DifferencesDear All, My question concerns whether it is possible to combine a Cox proportional hazards model w…
A question from an absolute beginner: hospitalization dataHi everybody. I have a set of hospital discharge records (time window 2001-2016) with the main diagn…
Matching observations across years for same idHi Forum, I am struggling with something very silly but would be very helpful if someone could help…
Test for coefficients of different regressionsDear All, I'm working with Fama & MacBeth regressions. My sample is divided in quintiles and I …
Subscribe to:
Post Comments (Atom)
0 Response to Program + Foreach
Post a Comment