Hi,
I do have a puzzling problem. I am computing gini coefficients using the bootstrap command to get standard errors. The program does not run because it stops, when trying to create a "__000000" variable that has been already created. Here is the program:
global pauv "C:\Users\Inégalités et pauvreté\Logs\Révision"
global IP "C:\Users\Inégalités et pauvreté\Bases\Révision"
clear all
capture log close
set more off
cap program drop _all
* Programmes
program define inegest, rclass
args var
ineqdeco `var' [fw=fweight]
global gini=$S_gini*100
global r9010=$S_9010
global r7525=$S_7525
global logdev=$S_i0
global theil=$S_i1
return scalar gini = $gini
return scalar r9010 = $r9010
return scalar r7525 = $r7525
return scalar logdev = $logdev
return scalar theil = $theil
end
log using "$pauv\inequality_se.log", replace
use "${IP}/base_inegpauv.dta", clear
global bootparm 250
svyset dr, strata(milieu) weight(poids_1_p12) vce(linearized) singleunit(missing) || idmen_c
outreg, clear
global typdep dep_pcap_total_men dep_pcap_nalim_men dep_pcap_alimt_men
global rows dep_pcap_total_men\dep_pcap_nalim_men\dep_pcap_ali mt_men
foreach var in $typdep {
set seed 34523
bootstrap gini=r(gini) r9010=r(r9010) r7525=r(r7525) logdev=r(logdev) theil=r(theil), reps($bootparm) strata(milieu) cluster(dr idmen_c): inegest "`var'"
matrix b_`var' = e(b)
matrix se_`var' = e(se)
matrix `var'=b_`var'[1,1],se_`var'[1,1],b_`var'[1,2],se_`var'[1,2],b_`var'[1,3],se_`var'[1,3],b_`var'[1,4],se_`var'[1,4],b_`var'[1,5],se_`var'[1,5]
matrix rownames `var'="`var'_est"
}
matrix balance=$rows
frmttable using "$pauv\table 3_se_pcap.doc", replace statmat(balance) sdec(2, 2, 2, 2, 2) substat(1) ///
title(Table 3b: "Inequality measures with SE") coljust(l c ) lan ///
ctitles("" , Gini, 90/10, 75/25, "mean log dev", theil) varl ///
basefont(fs10) titlfont(fs11 b) colwidth(20 9 9 9 9 9)
log close
and here is what I get when running the program (I only reproduce the bottom part of the listing):
. foreach var in $typdep {
2. set seed 34523
3. bootstrap gini=r(gini) r9010=r(r9010) r7525=r(r7525) logdev=r(logdev) theil=r(theil), reps($boo
> tparm) strata(milieu) cluster(dr idmen_c): inegest "`var'"
4. matrix b_`var' = e(b)
5. matrix se_`var' = e(se)
6. matrix `var'=b_`var'[1,1],se_`var'[1,1],b_`var'[1,2],se_`var'[1,2],b_`var'[1,3],se_`var'[1,3],b
> _`var'[1,4],se_`var'[1,4],b_`var'[1,5],se_`var'[1,5]
7. matrix rownames `var'="`var'_est"
8. }
(running inegest on estimation sample)
variable __000000 already defined
r(110);
I am currently using Stata 14. But the problem is the same when running Stata 13.
I used the trace command and I found that the problem is due to an instruction in the bootstrap.ado file, on line 281:
mark `touse' `cmdif' `cmdin'
I somehow solved the problem in creating a copy of this ado file and putting it in the C:\ado\personal directory (renaming it "bootstrapm.ado") and adding a
cap drop __000000
instruction before the mark instruction. But it is obviously not really satisfactory, and I would appreciate to get some help solving this matter in a more systematic and less empirical way.
Best,
Philippe
0 Response to Variable __000000 already defined
Post a Comment