Derivation
variable: maizeharv (table[s]: css_seh)
variable: riceharv (table[s]: css_seh)
variable: gnutharv (table[s]: css_seh)
<Cans of harvest is added together and then turned into a decile variable in relation to all other records with this data within the same year>
egen harvesttot=rowtotal(maizeharv riceharv gnutharv)
replace harvesttot=. if maizeharv==. & riceharv==. & gnutharv==.
foreach var in plot harvest harvsell {
foreach y in `yearlist' { /*make relative score by year*/
cap xtile `var'scorey`y'=`var'tot if year==`y', nq(10) /*score is created by splitting the population into deciles*/
if _rc~=0 gen `var'scorey`y'=.
}
egen `var'score=rowmax(`var'scorey*)
drop `var'scorey*
}