Page 1 of 1

Setting the smpl in pagesave command

Posted: Thu Aug 21, 2014 3:55 pm
by Young
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

Re: Setting the smpl in pagesave command

Posted: Thu Aug 21, 2014 4:58 pm
by EViews Gareth
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.

Re: Setting the smpl in pagesave command

Posted: Fri Aug 22, 2014 8:39 am
by Young
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