Dear Statalist forum,
I would like to construct a three-year average as the data is available in the three-year gap, 2011, 2014, and 2017.
I used the following state codes for the analysis. Please assist in whether I am working rightly for the average construction.
#delimit;
global xlist country code costs costr remgdp rem empe unem unemt tax_rev mob_subs port rail internet net_mig debt
mig_stoc mig_stock2 urban rural pop_dens dcps dcpsb dcpf gdp_gr gdp_c gdppc_p gdp_p saving house_exp Rearch
trade_opness second primary edu_exp edu_bac edu_sec edu_psec edu_prima edu_ter edu_ups edu_mas life_exp infc
infg bank_con accountf accountr accountw atm bran bank_con2 bank_dep bank_int_mar zscore bank_cris cred_card
debit deposit elect fsd_gdp h_stat ins_gdp int_debt ll_gdp loan_fi loan_12 mob_bill mob_mon prcrd pcmd save_12
save_fi kaopen ka_open;
#delimit cr
foreach var of varlist $xlist {
tssmooth ma x`var' = `var', w(3)
}
keep if (year==2011)| (year==2014)| (year == 2017)
gen period = 1
replace period = 1 if year == 2011
replace period = 2 if year == 2014
replace period = 3 if year == 2017
However, the average result is lower than the minimum value in three years, for example, if the value of year1 =2, year2=2.5, and for year3 = 3, than the average value must at least 2, and with the above codes, it's coming like 1.9 something.
Thanks for the assistance.
Related Posts with Three and five year averages
r603 using eventstudy commandDear Statalist, I am trying to run an event study using stata "db eventstudy" (eventstudy commandà …
dta files gets extremely large after appendingHi everyone! I have started learning Stata recently and I'm super excited to be here! I have been fo…
stata programming combining 2 variablesLet me explain, what I want to do here. I have four variables of household id (ssuid), year, month a…
Margin plots after xtreg not workingI have researched a lot on internet on different forums and could not find any satisfactory answer. …
Count distinct values of variable 'Year' for each different id in variable 'Id'Dear Statalist users, this is my first post in the forum and I am a Stata beginner, so please forgi…
Subscribe to:
Post Comments (Atom)
0 Response to Three and five year averages
Post a Comment