Hi everyone.
I am a novice of Stata and English is not my mother language. So I will try my best to explain as clear as possible the problem that I have run into.
I am currently using Stata 15.0 and my data having 20 variables. i created every possible combination out of them by using -tuples (SSC install). After that, I regress my dependent variable to every single combination by using -forvalues
in order to capture the estimation result, coefficients, bayesian information criterion. Unfortunately, something went wrong with my loop and i constantly got the same result for every regression. Stata somehow forgot the "combination" part that i would have wanted to added in the regression equation to be exact.
Here is my coding.
*Create variable to capture coefficients estimated.
foreach var of varlist `r(varlist)'{
gen b_`var'= .
}
ds, has(type double)
tuples `r(varlist)', varlist //SSC install tuples//
*looping
forval i = 1/`ntuples' {
probit GFC `tuple`i'' i.year
est sto model`i'
foreach var in `tuple`i'' {
scalar b_`var' = _b[`var']
replace b_`var' = `=scalar(b_`var')' in `i'
}
}
Stata somehow constantly returns the result of this regression: probit GFC i.year. I have tried many ways but it did not work at all.
Could you please explain what happened and show me how to fix it.
Many thanks and best regards
Related Posts with Content of local macro does not works in loop.
cloglog and proportional odds assumptionhello,everyone.it's the first time i write here.I hope you can understand my poor English because it…
Egen with weights?Hello, I am new to Stata and I am trying to calculate the proportion of women in different regions …
Can I take fixed effects( such as country id) as a continues covariate to controlHi guys, I am using a cross-section data to run 2sls regression. And there is a bunch of dummies com…
Using loop to create state-codes for statesHi, I have the following states. I want to assign a 2-digit code to each state. The dataex is given…
Help creating new variable using regression and fitted values, and creating a rolling average chartDear all, Hope all is well. Context: I am in the process of regressing director-turnover on the bo…
Subscribe to:
Post Comments (Atom)
0 Response to Content of local macro does not works in loop.
Post a Comment