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
Zero LR test statistic for melogitWhen using the following code Code: melogit goodprog i.screen i.dxagecat i.remoteness || sa3: , or…
Bootstrap with xtabond2Hello everyone, I am a beginner researcher. Now, I try my data with xtabond2 command. I see almost e…
Omitted coefficients using reghdfeHello, I am estimating regressions that include different fixed effects and variables whose coeffic…
[putdocx] Using if command to remove blank lineHello, I am making a lot of news report with putdocx command in Stata. I will collect various news …
Spatial model (xsmle) with spatial DV and IV lags and spatial errors?Is there a way to estimate a model with (1) a spatially lagged dependent variable, (2) spatially lag…
Subscribe to:
Post Comments (Atom)
0 Response to Three and five year averages
Post a Comment