Hi, I would like to set constraints later use them in a program. Here is a small example:
sysuse auto, clear
regress price weight mpg
local indep "weight mpg"
local ind=1
foreach var of varlist `indep' {
constraint `ind' `var'=_b[`var']
local ++ind
}
What I get is
. constraint list
1: weight=_b[weight]
2: mpg=_b[mpg]
So, my question is why my constraints do not have numbers, representing regression coefficients on the right hand sides?
I also tried modification:
sysuse auto, clear
regress price weight mpg
local indep "weight mpg"
local ind=1
foreach var of varlist `indep' {
local b`var'=_b[`var']
constraint `ind' `var'=`bvar'
local ++ind
}
but then I get
. constraint list
1: weight=
2: mpg=
Again no numbers, just blanks.
sysuse auto, clear
regress price weight mpg
local indep "weight mpg"
local ind=1
foreach var of varlist `indep' {
constraint `ind' `var'=_b[`var']
local ++ind
}
What I get is
. constraint list
1: weight=_b[weight]
2: mpg=_b[mpg]
So, my question is why my constraints do not have numbers, representing regression coefficients on the right hand sides?
I also tried modification:
sysuse auto, clear
regress price weight mpg
local indep "weight mpg"
local ind=1
foreach var of varlist `indep' {
local b`var'=_b[`var']
constraint `ind' `var'=`bvar'
local ++ind
}
but then I get
. constraint list
1: weight=
2: mpg=
Again no numbers, just blanks.
Comment