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

include sub_readx12spectrum.prg

'create workfile
workfile x12ex41 m 1979 1995

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

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

'-----------------------------------------------------------------------
'visually check seasonality
'-----------------------------------------------------------------------

'set adjustment sample
smpl 1980:1 @last

freeze(fig1) x.seasplot
show fig1

freeze(fig2) x.seasplot(m)
show fig2

'-----------------------------------------------------------------------
'run m1gold.spc
'-----------------------------------------------------------------------

'set adjustment sample
smpl 1980:1 @last

'call x12
%specfile = @runpath + "ev_m1gold.spc"
freeze(tab1) x.x12(ns, gdir="{%path}", sfile="{%specfile}")

'read seasonally adjusted series from evx12tmp.d11 dumped in {%path}
read(d=t,mult,rect,skiprow=2) "{%path}evx12tmp.d11" date x_d11

'read seasonal factors from evx12tmp.d10 dumped in {%path}
read(d=t,mult,rect,skiprow=2) "{%path}evx12tmp.d10" date x_d10

'plot spectrum of original series from evx12tmp.sp0 dumped in {%path}
%fname = %path + "evx12tmp.sp0"
%gname = "graph1"
call sub_readx12spectrum(%fname, %gname, 12)
{%gname}.addtext(t) Spectrum of original series
show {%gname}

