Setting the smpl in pagesave command

For questions regarding programming in the EViews programming language.

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

Young
Posts: 8
Joined: Wed Aug 13, 2014 7:46 am

Setting the smpl in pagesave command

Postby Young » Thu Aug 21, 2014 3:55 pm

Hello

I am trying to use the command pagesave to save output for a selected range of a workfile. I also need to assign the name of the output file dynamically. The below seems to work in terms of naming the output file, but it does not seem to work if I use %end in the smpl statement (it does work if I hardcode the dates). The error message I get is

Illegal date "8/21/2014 18:48:46" in "PAGESAVE..." (screenshot is attached)

Somehow it seems that @now includes the day and time in this line, but not within the main part of the workfile. The workfile is a dated structured file, monthly frequency, and I used the %end = @datestr(@now) line to set the end of the workfile range and sample.

%end = @datestr(@now)
%a = "output"+@datestr(@now, "yyyymmdd")+".csv"
pagesave %a @keep *real_avg @smpl %end(-24) %end '2012m9 2014m8

Any help would be much appreciated.

Thank you
Attachments
Untitled.png
Untitled.png (13.29 KiB) Viewed 2220 times

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

Re: Setting the smpl in pagesave command

Postby EViews Gareth » Thu Aug 21, 2014 4:58 pm

It's probably the (-24) that is screwing it up. That isn't a valid date. Use the @dateadd function to take 24 off your date.

Young
Posts: 8
Joined: Wed Aug 13, 2014 7:46 am

Re: Setting the smpl in pagesave command

Postby Young » Fri Aug 22, 2014 8:39 am

Thanks - -this worked.

%end = @datestr(@now)
%a = "output"+@datestr(@now, "yyyymmdd")+".csv"
%start = @datestr(@dateadd(@dateval(%end),-24,"mm"))
pagesave %a @keep *real_avg @smpl %start %end


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest