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
What's the principle behind twoway graph's legend and its label optionDear Stata users, I have an interesting finding regards to twoway graph's legend option, put it pre…
Expand value within groupDear all, I am currently working on a patient consultations database from 2016 to 2021. My purpose …
cvlasso lambda list truncated starting in v14I am using cvlasso and it seems to be truncating the number of lambda's generated when the lminratio…
Problem with stcox hazard modelHi all, I am trying to use stcox to create a multivariable cox proportional hazard model. I am runni…
Trend analysisI am interested in comparing a linear trend model with 1) power trend, 2) exponential trend, and 3) …
Subscribe to:
Post Comments (Atom)
0 Response to Three and five year averages
Post a Comment