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)
Related Posts with Problem with a synth command : error "uno() invalid -- invalid numlist has too many elements"
Generating a variable for user pre and post policy changeHI, So I have panel data for 5 years (4,5,6,7,8) and I am evaluating a policy change that happened …
Lasso error message "error in postselection b"Hi everyone, I encountered this error when I was running the Lasso, "error in postselection b". Co…
List of long string varsI am simply looking to get a list of all the different values of a string variable, but some of them…
How to create a plot showing the results of an OLS regressionDear all, I ran a panel regression taking the form of y = x1 +x12 + other control variable using …
How to perform PSM without replacement using teffects psmach commandDear all, I want to perform 1:1 nearest neighbourhood PSM wihtout replacement, and get AI variance. …
Subscribe to:
Post Comments (Atom)
0 Response to Problem with a synth command : error "uno() invalid -- invalid numlist has too many elements"
Post a Comment