Hi all,
I think I'm having a temporary variable problem when I'm using binsreg and attempting to use the savedata option. I am having trouble reproducing the error with fake data but below is my code and the portion of the trace output that highlights the error (I've bolded it and turned it red so you can see it). I hope that is sufficient for posting the problem - but apologies in advance if you cannot help without a reproducible version of the error. But I would be grateful for any tips you could give for troubleshooting:
binsreg var_y var_x, by(categorical_var) samebinsby savedata("save_binnscatter_data") replace
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- begin label ---
- version 10.0
- local vv : display "version " string(_caller()) ", missing:"
- gettoken val : 0
- if (strpos("`val'", "val") > 0 ) {
= if (strpos("val", "val") > 0 ) {
- gettoken val 0 : 0
- syntax anything [, nofix]
- if "`fix'" != "" {
= if "" != "" {
local fix ", nofix"
}
- gettoken var rest : anything
- while `"`rest'"' != "" {
= while `" __000006"' != "" {
- gettoken lab rest : rest
- local label "`lab'"
= local label "__000006"
- }
- while `"`rest'"' != "" {
= while `""' != "" {
gettoken lab rest : rest
local label "`lab'"
}
- local vlist : list anything - lab
- if "`lab'" == "." {
= if "__000006" == "." {
local lab ""
}
- foreach var of varlist `vlist' {
= foreach var of varlist group {
- `vv' _label `val' `var' `lab' `fix'
= version 13, missing: _label val group __000006
- }
- }
- else {
`vv' _label `macval(0)'
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end label ---
- decode group, gen(`byvarname')
= decode group, gen(year)
value label __000006 not found
}
else {
qui gen `byvarname'=group
if ("`bylabel'"!="") label val `byvarname' `bylabel'
}
label var `byvarname' "Group"
qui drop group
order `byvarname'
}
else qui drop group
capture confirm variable dots_x dots_binid dots_isknot dots_fit
if (_rc==0) {
label var dots_x "Dots: grid"
label var dots_binid "Dots: indicator of bins"
label var dots_isknot "Dots: indicator of inner knot"
label var dots_fit "Dots: fitted values"
}
capture confirm variable line_x line_binid line_isknot line_fit
if (_rc==0) {
label var line_x "Line: grid"
label var line_binid "Line: indicator of bins"
label var line_isknot "Line: indicator of inner knot"
label var line_fit "Line: fitted values"
}
capture confirm variable poly_x poly_binid poly_isknot poly_fit
if (_rc==0) {
label var poly_x "Poly: grid"
label var poly_binid "Poly: indicator of bins"
label var poly_isknot "Poly: indicator of inner knot"
label var poly_fit "Poly: fitted values"
}
capture confirm variable polyCI_x polyCI_binid polyCI_isknot polyCI_l polyCI_r
if (_rc==0) {
label var polyCI_x "Poly confidence interval: grid"
label var polyCI_binid "Poly confidence interval: indicator of bins"
label var polyCI_isknot "Poly confidence interval: indicator of inner knot"
label var polyCI_l "Poly confidence interval: left boundary"
label var polyCI_r "Poly confidence interval: right boundary"
}
capture confirm variable CI_x CI_binid CI_isknot CI_l CI_r
if (_rc==0) {
label var CI_x "Confidence interval: grid"
label var CI_binid "Confidence interval: indicator of bins"
label var CI_isknot "Confidence interval: indicator of inner knot"
label var CI_l "Confidence interval: left boundary"
label var CI_r "Confidence interval: right boundary"
}
capture confirm variable CB_x CB_binid CB_isknot CB_l CB_r
if (_rc==0) {
label var CB_x "Confidence band: grid"
label var CB_binid "Confidence band: indicator of bins"
label var CB_isknot "Confidence band: indicator of inner knot"
label var CB_l "Confidence band: left boundary"
label var CB_r "Confidence band: right boundary"
}
label var binid "Bin: ID"
label var lef_ep "Bin: left endpoint"
label var rig_ep "Bin: right endpoint"
qui save `"`savedata'"', `replace'
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end binsreg ---
r(111); t=137.65 22:04:34
end of do-file
I think I'm having a temporary variable problem when I'm using binsreg and attempting to use the savedata option. I am having trouble reproducing the error with fake data but below is my code and the portion of the trace output that highlights the error (I've bolded it and turned it red so you can see it). I hope that is sufficient for posting the problem - but apologies in advance if you cannot help without a reproducible version of the error. But I would be grateful for any tips you could give for troubleshooting:
binsreg var_y var_x, by(categorical_var) samebinsby savedata("save_binnscatter_data") replace
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- begin label ---
- version 10.0
- local vv : display "version " string(_caller()) ", missing:"
- gettoken val : 0
- if (strpos("`val'", "val") > 0 ) {
= if (strpos("val", "val") > 0 ) {
- gettoken val 0 : 0
- syntax anything [, nofix]
- if "`fix'" != "" {
= if "" != "" {
local fix ", nofix"
}
- gettoken var rest : anything
- while `"`rest'"' != "" {
= while `" __000006"' != "" {
- gettoken lab rest : rest
- local label "`lab'"
= local label "__000006"
- }
- while `"`rest'"' != "" {
= while `""' != "" {
gettoken lab rest : rest
local label "`lab'"
}
- local vlist : list anything - lab
- if "`lab'" == "." {
= if "__000006" == "." {
local lab ""
}
- foreach var of varlist `vlist' {
= foreach var of varlist group {
- `vv' _label `val' `var' `lab' `fix'
= version 13, missing: _label val group __000006
- }
- }
- else {
`vv' _label `macval(0)'
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end label ---
- decode group, gen(`byvarname')
= decode group, gen(year)
value label __000006 not found
}
else {
qui gen `byvarname'=group
if ("`bylabel'"!="") label val `byvarname' `bylabel'
}
label var `byvarname' "Group"
qui drop group
order `byvarname'
}
else qui drop group
capture confirm variable dots_x dots_binid dots_isknot dots_fit
if (_rc==0) {
label var dots_x "Dots: grid"
label var dots_binid "Dots: indicator of bins"
label var dots_isknot "Dots: indicator of inner knot"
label var dots_fit "Dots: fitted values"
}
capture confirm variable line_x line_binid line_isknot line_fit
if (_rc==0) {
label var line_x "Line: grid"
label var line_binid "Line: indicator of bins"
label var line_isknot "Line: indicator of inner knot"
label var line_fit "Line: fitted values"
}
capture confirm variable poly_x poly_binid poly_isknot poly_fit
if (_rc==0) {
label var poly_x "Poly: grid"
label var poly_binid "Poly: indicator of bins"
label var poly_isknot "Poly: indicator of inner knot"
label var poly_fit "Poly: fitted values"
}
capture confirm variable polyCI_x polyCI_binid polyCI_isknot polyCI_l polyCI_r
if (_rc==0) {
label var polyCI_x "Poly confidence interval: grid"
label var polyCI_binid "Poly confidence interval: indicator of bins"
label var polyCI_isknot "Poly confidence interval: indicator of inner knot"
label var polyCI_l "Poly confidence interval: left boundary"
label var polyCI_r "Poly confidence interval: right boundary"
}
capture confirm variable CI_x CI_binid CI_isknot CI_l CI_r
if (_rc==0) {
label var CI_x "Confidence interval: grid"
label var CI_binid "Confidence interval: indicator of bins"
label var CI_isknot "Confidence interval: indicator of inner knot"
label var CI_l "Confidence interval: left boundary"
label var CI_r "Confidence interval: right boundary"
}
capture confirm variable CB_x CB_binid CB_isknot CB_l CB_r
if (_rc==0) {
label var CB_x "Confidence band: grid"
label var CB_binid "Confidence band: indicator of bins"
label var CB_isknot "Confidence band: indicator of inner knot"
label var CB_l "Confidence band: left boundary"
label var CB_r "Confidence band: right boundary"
}
label var binid "Bin: ID"
label var lef_ep "Bin: left endpoint"
label var rig_ep "Bin: right endpoint"
qui save `"`savedata'"', `replace'
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end binsreg ---
r(111); t=137.65 22:04:34
end of do-file
Comment