'eviews x12 interface
'replicate example 8 provided by census
'warning: data file path hard-coded in .spc files
'version 4
'last checked and revised 10/27/2000 h

'create workfile
workfile x12ex81 m 1972 1989

'read series
%datafile = @runpath + "s0b566.dat"
read(norect,dropstrings) "{%datafile}" x

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

'-----------------------------------------------------------------------
'no preadjustment in transform
'-----------------------------------------------------------------------

'call x12 with external spec file
smpl @all
%specfile = @runpath + "ev_beauto0.spc"
freeze(tab0) x.x12(gdir="{%path}", ns, sfile="{%specfile}") x0

'read history of logl and AIC from evx12tmp.lkh dumped in {%gpath}
smpl 1979:1 @last
read(d=t,mult,rect,skiprow=2) "{%path}evx12tmp.lkh" date x0logl x0aic

'-----------------------------------------------------------------------
'with preadjustment in transform
'-----------------------------------------------------------------------

'read subjective adjustment factors
smpl @all
%datafile = @runpath + "beauto.adj"
read(norect,dropstrings) "{%datafile}" xadj

'display subjective factors
xadj.displayname subjective factors (hybrid?)
freeze(gra_adj) xadj.line
show gra_adj

'call x12 with external spec file
smpl @all
%specfile = @runpath + "ev_beauto.spc"
freeze(tab1) x.x12(gdir="{%path}", ns, sfile="{%specfile}") x1

'read history of logl and AIC from evx12tmp.lkh dumped in {%gpath}
smpl 1979:1 @last
read(d=t,mult,rect,skiprow=2) "{%path}evx12tmp.lkh" date x1logl x1aic

'-----------------------------------------------------------------------
'compare effect of preadjustment
'-----------------------------------------------------------------------

'AIC difference
series adiff = x0aic - x1aic
adiff.displayname no_adj_aic - adj_aic
freeze(gra2) adiff.line
gra2.addtext(t) History of AIC difference
show gra2

series ldiff = x0logl - x1logl
ldiff.displayname no_adj_logl - adj_logl
freeze(gra3) ldiff.line
gra3.addtext(t) History of logl difference
show gra3

