Date: Thu, 22 Mar 2012 16:29:49 -0400
Reply-To: Tom Abernathy <tom.abernathy@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Tom Abernathy <tom.abernathy@GMAIL.COM>
Subject: Re: quoting in SYSFUNC vs data step
Data step complains in the same way when you give 'month' instead of month.
907 data zz;
908 input month date9.;
909 format month end date9.;
910 end = intnx( "'month'", '01mar2012'd , 0 , 'e' );
911 put month= end=;
912 cards;
NOTE: Invalid argument to function INTNX at line 910 column 9.
On Thu, 22 Mar 2012 14:42:43 -0400, Bolotin Yevgeniy
<YBolotin@SCHOOLS.NYC.GOV> wrote:
>Toby is of course absolutely right, except E = end (last day), B =
>beginning (first)
>
>
>Slightly off topic - why does this work as written but NOT work if month
>and E/B are quoted? (a data step does the opposite)
>
>
>%put %SysFunc( IntnX( Month, '01Mar2012'd , 0 , E ) ); * works - I do
>not understand why ;
>%put %SysFunc( IntnX( 'Month', '01Mar2012'd , 0 , 'E' ) ); *produces
>WARNING: An argument to the function INTNX referenced by the %SYSFUNC or
>%QSYSFUNC macro function is out of range - I do not understand why ;
>
>
>data _z;
> a = IntnX( Month , '01Mar2012'd , 0 , E ) ; * complains of
>undefined Month and E, as can be expected ;
> b = IntnX( 'Month' , '01Mar2012'd , 0 , 'E' ) ; * works ;
> format a mmddyy10. b mmddyy10. ;
> put a= b=;
>run;
>
>
>-----Original Message-----
>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
>toby dunn
>Sent: Thursday, March 22, 2012 2:23 PM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Re: Urgently Need Macro Help
>
>%SysFunc( IntnX( Month , "01Mar2012'd , 0 , E ) ) ---->>>> gives yo
>uthe first of the month
>%SysFunc( IntnX( Month , "01Mar2012'd , 0 , B ) ) ----->>>> gives you
>the last day of the month
>
>
>Toby Dunn
>
>
>If you get thrown from a horse, you have to get up and get back on,
>unless you landed on a cactus; then you have to roll around and scream
>in pain.
>
>"Any idiot can face a crisis-it's day to day living that wears you out"
>~ Anton Chekhov
>
>
>
>> Date: Thu, 22 Mar 2012 11:16:00 -0700
>> From: john_rr_irc@YAHOO.COM
>> Subject: Urgently Need Macro Help
>> To: SAS-L@LISTSERV.UGA.EDU
>>
>> Hi All,
>>
>> In the following program I want to read the first day of the current
>month and the last day of the current month
>> dynamically. So, that every month I don't have to change the dates. I
>don't like the idea of hard coding the begin and end date every month.
>>
>>
>> %let begin='01mar12'd; /*** first day of the month ***/
>> %let end ='31mar12'd; /*** last day of the month ***/
>>
>> data daily.Daily_del_&sysdate;
>> set daily.comprehensive_&sysdate;
>> where del_date ge &begin and del_date le &end;
>> run;
>> %mend;
>>
>> Thank you for your help.
>>
>> JRR
|