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.
Summary Variables for Household CharacteristicsHello Statalisters,
I'm trying to summarize some statistics by household (NUM_HOG). Specifically, I …
Stata commmands to analyze data where each record contains monthly totals: aggregate data problem but not really a wide to long solutionHi,
I have some health centre data from Africa where each record consists of fields that represent …
Dummy VariableHi,
So I created a dummy variable by the following code:
gen YearGroup = 0
replace YearGroup = 1 i…
PVAR irfDear All,
I'm running panel var on two datasets and i want to compare their irf graphs. i want to pu…
Converting data to numericHi All,
I have the following dataset:
Code:
* Example generated by -dataex-. To install: ssc ins…
Subscribe to:
Post Comments (Atom)
0 Response to Content of local macro does not works in loop.
Post a Comment