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

include sub_readx12spectrum.prg

'create workfile
workfile x12ex71 m 1980 1996

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

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

'-----------------------------------------------------------------------
'default run (full sample)
'-----------------------------------------------------------------------

'call x12 without external spec file
freeze(tab0) x.x12(gdir="{%path}", save="d10", check, tf=0, flead=24, outlier, plotspectra, amdl=f) x0

'make copy of diagnostic spetra (will be overwritten)
copy gr_x0_sp gr0spe
show gr0spe

'plot regARIMA resid spectrum
%fname = %path + "EVX12TMP.spr"
%gname = "g0res"
!freq = 12
call sub_readX12Spectrum(%fname, %gname, !freq)
{%gname}.addtext(t) Spectrum of regARIMA residuals (full sample)
show {%gname}

'-----------------------------------------------------------------------
'default run (subsample as in cetg0.spc)
'-----------------------------------------------------------------------

smpl 1986:1 @last
'call x12 without external spec file
freeze(tab1) x.x12(gdir="{%path}", save="d10", check, tf=0, flead=24, outlier, plotspectra, amdl=f) x1

'make copy of diagnostic spetra (will be overwritten)
copy gr_x1_sp gr1spe
show gr1spe

'plot regARIMA resid spectrum
%fname = %path + "EVX12TMP.spr"
%gname = "g1res"
!freq = 12
call sub_readX12Spectrum(%fname, %gname, !freq)
{%gname}.addtext(t) Spectrum of regARIMA residuals (subsample)
show {%gname}

