Announcement

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

  • Problem with a synth command : error "uno() invalid -- invalid numlist has too many elements"

    Dear all,

    As described in the title, I try to implement the Synthetic Control method on STATA to study generational farm transmissions between old and young farmers.
    I use the SSC synth and the synth command, but it is returned : "uno() invalid -- invalid numlist has too many elements". I don't understand why.
    Does someone can help me please ?

    I add to this topic my STATA code, the synthetic control method is at the end :




    ************************************************** ************************************************** ************************************************** *************************

    /* Define macros */
    global varlist "idnum milex pbuce cdexe otexe extr2 regio fjuri tra05 utans utasa utato ebexp otefdd"
    local y_i = 2000
    local y_f = 2018
    local depvar "pbuce"

    /* Panel */
    forvalues y = `y_i'/`y_f' {
    import delimited "*********", delimiter(";")
    display as text "year: " as result `y'
    sort `depvar' extr2
    tempfile tfile_`y'
    quietly save `tfile_`y''
    clear
    }
    clear
    forvalues y = `y_i'/`y_f' {
    display as text "year: " as result `y'
    quietly append using `tfile_`y''
    }
    save panel_`y_i'_`y_f', replace

    /**** Identify generation change ***/
    use "********************************************* '", clear
    sort idnum
    xtset idnum milex, yearly
    keep $varlist
    generate ch2younger = (D.tra05 <= -3)
    generate ch2older = (D.tra05 >= 3 & D.tra05 > .)
    by idnum: egen nb_ch2younger = sum(ch2younger)
    by idnum: egen nb_ch2older = sum(ch2older)



    ******** Gestion des données
    generate transmission = (nb_ch2younger > 0 & nb_ch2older == 0)
    generate generation = 1
    by idnum: replace generation = 1 + sum(ch2younger)
    by idnum: egen nb_annee_observation = count(idnum)
    generate AvantApres = (generation > 1)
    bysort idnum generation: egen nb_annee_generation = count(generation)
    by idnum: egen min_nb_annee_generation = min(nb_annee_generation)
    by idnum: egen nb_an_avant = count(idnum) if AvantApres == 0
    by idnum: egen nb_an_apres = count(idnum) if AvantApres == 1
    keep if nb_an_avant >= 5 & nb_an_apres >= 5
    generate sample = (min_nb_annee_generation >= 3 & min_nb_annee_generation < .)
    keep if sample == 1

    generate sup1 = (cdexe == 1 | cdexe == 2 | cdexe == 3 | cdexe == 4 | cdexe == 5)
    drop if sup1 == 1 /* On a viré des cdexe qui avait des pourcentages inférieurs à 1*/
    generate sup2 = (fjuri == 9)
    drop if sup2 == 1 /* Moins de 1% des observations */
    drop if fjuri == 1 /* On en a parlé */


    ******** Gestion des données
    drop if nb_ch2younger > 1
    drop if nb_ch2older > 0



    ******** Synthetic control
    ssc install synth
    synth ebexp pbuce(2000(1)2018) cdexe(2000(1)2018) otexe(2000(1)2018) regio(2000(1)2018) fjuri(2000(1)2018) tra05(2000(1)2018), trunit(43123) trperiod(2008)

  • #2
    HI Minuteslim,
    Welcome to Statalist. You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex. Being able to replicate your problem can be essential to helping you.

    Comment

    Working...
    X