'eviews x12 interface
'replicate example 1 provided by census
'version 4
'last checked and revised 10/27/2000 h

'create workfile
workfile x12ex11 m 1967 1999

'read data
%datafile = @runpath + "s0b566.dat"
read(t,d=s,mult,norect,dropstrings) "{%datafile}" x

'estimation subsample
sample smod 1983:1 @last

'set path to dump x12 graphics metafiles
'*must set to writeable path*
%path = @temppath + "\x12graphs\"

'-----------------------------------------------------------------------
'run shoersm1.spc (x11easter adj)
'-----------------------------------------------------------------------

'set adjustment sample
smpl 1972:1 @last

'call x12
%specfile = @runpath + "ev_shoersm1.spc"
freeze(tab1) x.x12(modelsmpl=smod, ns, save="h1", gdir="{%path}", sfile="{%specfile}")
'show tab1

'read history of sum of squared forecast errors
'from evx12tmp.fce dumped in {%path}

smpl 1991:2 @last
read(d=t,mult,rect,skiprow=2) "{%path}evx12tmp.fce" date x1fce01 x1fce12

'-----------------------------------------------------------------------
'run shoersm2.spc (x11easter adj)
'-----------------------------------------------------------------------

'set adjustment sample
smpl 1972:1 @last

'call x12
%specfile = @runpath + "ev_shoersm2.spc"
freeze(tab2) x.x12(modelsmpl=smod, ns, gdir="{%path}",  sfile="{%specfile}")

'show tab2

'read history of sum of squared forecast errors
'from evx12tmp.fce dumped in {%path}

smpl 1991:2 @last
read(d=t,mult,rect,skiprow=2) "{%path}evx12tmp.fce" date x2fce01 x2fce12

'-----------------------------------------------------------------------
'compare adjustments via difference of forecast errors
'-----------------------------------------------------------------------

series diff01 = x2fce01 - x1fce01
series diff12 = x2fce12 - x1fce12
diff01.displayname lag 1 
diff12.displayname lag 12 

group g1 diff01 diff12
freeze(graph1) g1.line

'add title
graph1.addtext(t) Difference of sum-of-squared forecast errors (reg_easter - x11easter)

'add zero line
graph1.draw(dashline,left) 0
show graph1

