Write Command - Using Wildcards to Dump Specific Series

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

MT_MANC
Posts: 25
Joined: Tue Mar 10, 2009 5:22 am

Write Command - Using Wildcards to Dump Specific Series

Postby MT_MANC » Mon Sep 07, 2009 9:10 am

Is there a specific wildcard syntax for the "Write" command when specying particular Series to be dumped to a Lotus .wk1 file ?
I'm trying to avoid having to type out lines 2 & 3 in entirety in PRG code snippet below; the obvious use of " *_sa" or "CBI*_sa" both get an error message !

Code: Select all

WRITE(B2,t=WK1,na="",dates) c:\data\WS3\COI_CBIrts_index_SA.wk1 _ CBIconfi_nw_sa CBIoutpi_nw_sa CBIoutfi_nw_sa CBInopi_nw_sa CBInofi_nw_sa CBInxopi_nw_sa CBInxofi_nw_sa CBIbcapi_nw_sa _ CBIconfi_ne_sa CBIoutpi_ne_sa CBIoutfi_ne_sa CBInopi_ne_sa CBInofi_ne_sa CBInxopi_ne_sa CBInxofi_ne_sa CBIbcapi_ne_sa

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Write Command - Using Wildcards to Dump Specific Series

Postby EViews Gareth » Mon Sep 07, 2009 9:22 am

Try using wfsave rather than write.

MT_MANC
Posts: 25
Joined: Tue Mar 10, 2009 5:22 am

Re: Write Command - Using Wildcards to Dump Specific Series

Postby MT_MANC » Tue Sep 08, 2009 4:24 am

Gareth
Most Kind

I tried various syntaxes of wfsave (no examples in eVIEWS Command Reference)

I want to dump all varialbles ending in "_sa" over the entire sample period to an external worksheet (ideally to .wk1 but no such format seems permissable ?, so Excel used instead)

Code: Select all

wfsave (type=excel) "C:\data\WS_COI\CBIrts_index_SA.xls" @keep *_sa @smpl all
..causes Eviews 6 to crash, as does:

Code: Select all

wfsave (type=excel) "C:\data\WS_COI\CBIrts_index_SA.xls" @keep *_sa @smpl 1970:1 2020:4
Q. Are there any more examples anywhere to edit as required (couldnt see any in Forum OR search of Google) ?
Q. I presume dumping large workfile to multi-sheet workbook is not (yet) possible ?

Thanks again

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Write Command - Using Wildcards to Dump Specific Series

Postby EViews Gareth » Tue Sep 08, 2009 8:16 am

Something simple like

Code: Select all

wfsave "C:\data\WS_COI\CBIrts_index_SA.wk1" @keep *_sa
is all you should need.

The examples under WFOPEN are generally applicable to WFSAVE.

I don't understand what you mean by your large workfiles question.

MT_MANC
Posts: 25
Joined: Tue Mar 10, 2009 5:22 am

Re: Write Command - Using Wildcards to Dump Specific Series

Postby MT_MANC » Tue Sep 08, 2009 9:17 am

Thanks- this almost works but how can I get the .wk1 dump to display (quarterly) dates down the leftmost column
as happens with WRITE command (which CANNOT use wildcards) ?

I'm presuming that the above Wildcards CANNOT be used in "For:Next" loop with String Variables ?
eg following will fail....

Code: Select all

for %x4 CNO*_nw {%x4}.x12(mode=a,save="d10 d11 d12") next
...but this will work:

Code: Select all

for %x4 CNOoutp_nw CNOordp_nw CNOinp_nw CNOinp_nw {%x4}.x12(mode=a,save="d10 d11 d12") next
"Large wf" - where no of series selected for dumping (via wildcards) exceeds 256 (= max no. of columns of single Lotus/Excel worksheet)

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Write Command - Using Wildcards to Dump Specific Series

Postby EViews Gareth » Tue Sep 08, 2009 9:36 am

No, a wildcard cannot be used in loops. However you can make a group using the wildcard, then loop through the members of the group.


There is no way to get EViews to write into different sheets for large files.

MT_MANC
Posts: 25
Joined: Tue Mar 10, 2009 5:22 am

Re: Write Command - Using Wildcards to Dump Specific Series

Postby MT_MANC » Tue Sep 08, 2009 10:17 am

Most Kind

wfsave - how can I get the .wk1 dump to display (quarterly) dates down the leftmost column
(as happens with WRITE command )

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Write Command - Using Wildcards to Dump Specific Series

Postby EViews Gareth » Tue Sep 08, 2009 10:43 am

Sorry, missed that question first time.

That's actually a bit more complicated (only slightly though). Use the following:

Code: Select all

alpha dates = @datestr(@date) wfsave "C:\data\WS_COI\CBIrts_index_SA.wk1" @keep dates *_sa

MT_MANC
Posts: 25
Joined: Tue Mar 10, 2009 5:22 am

Re: Write Command - Using Wildcards to Dump Specific Series

Postby MT_MANC » Wed Sep 09, 2009 3:19 am

Gareth
I've adapted this slightly:

Code: Select all

alpha dates = @datestr(@date,"YYYY[Q]Q") wfsave "C:\data\WS_COI\CNO_raw_SA.wk1" @keep dates CNO*_sa
to give me dates in "1970Q1" format - thanks again

...but any hints to prevent "NA" being dumped in .wk1 where data/forecast value missing
ie replacing "NA" with "" ie empty cell in wk1 dump ("Write" function seems to have this as an option but not wfsave ? )

MT_MANC
Posts: 25
Joined: Tue Mar 10, 2009 5:22 am

Re: Write Command - Using Wildcards to Dump Specific Series

Postby MT_MANC » Fri Sep 11, 2009 5:47 am

Gareth

Not sure if your saw my final question on wfsave function:

..any hints to prevent "NA" being dumped in .wk1 where data/forecast value missing
ie replacing "NA" with "" ie empty cell in wk1 dump ("Write" function seems to have this as an option but not wfsave ? )

Thanks again

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Write Command - Using Wildcards to Dump Specific Series

Postby EViews Gareth » Fri Sep 11, 2009 6:25 am

I don't think there is a way to do that with WFSAVE.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest