This code
Code: Select all
calendar(q) 1947 1
compute begin_samp = 1969:1
compute end_samp = 2012:4
compute end_fcast = 2015:4
open data "data.csv"
data(format = cdf, org = columns) begin_samp end_samp $
gdph cdh
close data
declare hash[frml] ids
smpl begin_samp end_samp
dofor s = gdph cdh
compute growth = %l(s) + "_growth"
compute mean_growth = %l(s) + "_mean_growth"
set %s(growth) = s{0} / s{1}
statistics(print) %s(growth)
set %s(mean_growth) begin_samp end_fcast = %mean
frml(identity) ids(%l(s)) s = s{1} * %s(mean_growth)
end dofor s
group mdl ids("gdph")>> gdph ids("cdh")>> cdh
forecast(model = mdl, from = end_samp+1, to = end_fcast, print)
Code: Select all
ENTRY GDPH CDH GDPH_GROWTH GDPH_MEAN_GROWTH CDH_GROWTH CDH_MEAN_GROWTH
2012:02 15500.200000000 1300.8000000000 1.002781875113 1.006964245134 1.005565862709 1.01296758509
2012:03 15614.400000000 1311.2000000000 1.007367646869 1.006964245134 1.007995079951 1.01296758509
2012:04 15761.500000000 1324.6000000000 1.009420791065 1.006964245134 1.010219646126 1.01296758509
2013:01 1.012967585 1.0129675851 NA 1.006964245134 NA 1.01296758509
2013:02 1.012967585 1.0129675851 NA 1.006964245134 NA 1.01296758509
2013:03 1.012967585 1.0129675851 NA 1.006964245134 NA 1.01296758509
2013:04 1.012967585 1.0129675851 NA 1.006964245134 NA 1.01296758509
2014:01 1.012967585 1.0129675851 NA 1.006964245134 NA 1.01296758509
2014:02 1.012967585 1.0129675851 NA 1.006964245134 NA 1.01296758509
2014:03 1.012967585 1.0129675851 NA 1.006964245134 NA 1.01296758509
2014:04 1.012967585 1.0129675851 NA 1.006964245134 NA 1.01296758509
2015:01 1.012967585 1.0129675851 NA 1.006964245134 NA 1.01296758509
2015:02 1.012967585 1.0129675851 NA 1.006964245134 NA 1.01296758509
2015:03 1.012967585 1.0129675851 NA 1.006964245134 NA 1.01296758509
2015:04 1.012967585 1.0129675851 NA 1.006964245134 NA 1.01296758509
Code: Select all
frml(identity) ids(%l(s)) s = s{1} * %s(mean_growth)
As I said, I'll just use this code in the project itself:
Code: Select all
calendar(q) 1947 1
compute begin_samp = 1969:1
compute end_samp = 2012:4
compute end_fcast = 2015:4
open data "data.csv"
data(format = cdf, org = columns) begin_samp end_samp $
gdph cdh
close data
declare hash[frml] ids
smpl begin_samp end_samp
dofor s = gdph cdh
compute growth = %l(s) + "_growth"
compute mean_growth = %l(s) + "_mean_growth"
set %s(growth) = s{0} / s{1}
statistics(print) %s(growth)
set s end_samp+1 end_fcast = s{1} * %mean
end dofor s
print end_samp-2 end_fcast