Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    The local macro countries was created by the earlier levelsof command whose output is shown in the third picture in post #9.

    Comment


    • #17
      Right again. So there is just one country ZAF,

      Comment


      • #18
        Hello,

        I do have the same puzzling problem as Busi. 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

        Comment


        • #19
          Hi Everyone,

          I'm late to this party but I encountered a similar issue today where I was hitting this issue in a program I wrote.

          . levelsof VIETNAM , local(groups)
          -------------------------------------------------------------------------------------------------------------- begin levelsof ---
          01 - version 15.0
          01 - syntax varname [if] [in] [, Separate(str) MISSing Local(name local) Clean MATROW(name) MATCELL(name) HEXadecimal ]
          01 - if ("`missing'" == "") {
          = if ("" == "") {
          01 - marksample touse, strok
          variable __000000 already defined
          01 }
          ---------------------------------------------------------------------------------------------------------------- end levelsof ---


          The issue was really weird because the issue was originating from within the levelsof command. It turns out that I had saved the data at an intermediate step, which had saved the temporary variables. I'm <guessing> this confused Stata as to which names it had already used, which is why it got testy when I ran the levelsof command. Once I deleted the intermediate save, there was no further issue.

          Hopefully this clarifies stuff for others!

          Cheers,

          David.

          Comment

          Working...
          X