'eviews x12 interface
'replicate example 9 provided by census
'trend extraction of seasonally adjusted series
'version 4
'last checked and revised 10/27/2000 h

'create workfile
workfile x12ex91 m 1981 1997

'read series
%datafile = @runpath + "usstrts2.dat"
read(norect,dropstrings) "{%datafile}" x
'precision=1
x = x/10

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

'-----------------------------------------------------------------------
'seasonal adjustment and trend
'-----------------------------------------------------------------------

'call x12
smpl 84:3 @last
%specfile = @runpath + "ev_strtsnsd0.spc"
freeze(tab0) x.x12(gdir="{%path}", ns, sfile="{%specfile}") x0

'read trend-cycle from evx12tmp.d12 dumped in {%path}
read(d=t,mult,rect,skiprow=2) "{%path}evx12tmp.d12" date x0d12

'-----------------------------------------------------------------------
'only trend
'-----------------------------------------------------------------------

smpl 84:3 @last
%specfile = @runpath + "ev_strtsnsd.spc"
freeze(tab1) x.x12(gdir="{%path}", ns, sfile="{%specfile}") x1

'read trend-cycle from evx12tmp.d12 dumped in {%path}
read(d=t,mult,rect,skiprow=2) "{%path}evx12tmp.d12" date x1d12

'-----------------------------------------------------------------------
'display difference
'-----------------------------------------------------------------------

series tcdiff = x0d12 - x1d12
tcdiff.displayname adj_trend - no_adj_trend
freeze(gra1) tcdiff.line
show gra1

