<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic SAS Macro error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-error/m-p/311960#M67573</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have this part of a SAS Macro&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; runmonth=&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(intnx(month,&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(today()),-1),yymmn6.); &lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*Curr Month*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; lastmonth=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;(intnx(month,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;(today()),-2),yymmn6.); &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*Prev Month*/&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; runmonth2=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;(intnx(month,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;(today()),-1),yymmdd10.); &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*Curr Month*/&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; HPIDate=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;(intnx(quarter,"&amp;amp;runmonth."d,0,e),yymmdd10.); &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*last month of previous Qtr*/&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and when I run the HPIDate, I get this error message&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;14 GOPTIONS ACCESSIBLE;&lt;/P&gt;
&lt;P&gt;SYMBOLGEN: Macro variable RUNMONTH resolves to 201610&lt;/P&gt;
&lt;P&gt;ERROR: Argument 2 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number.&lt;/P&gt;
&lt;P&gt;ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list. Execution of %SYSCALL statement or %SYSFUNC&lt;/P&gt;
&lt;P&gt;or %QSYSFUNC function reference is terminated.&lt;/P&gt;
&lt;P&gt;15 %let HPIDate=%sysfunc(intnx(quarter,"&amp;amp;runmonth."d,0,e),yymmdd10.);&lt;/P&gt;
&lt;P&gt;16&lt;/P&gt;
&lt;P&gt;17 GOPTIONS NOACCESSIBLE;&lt;/P&gt;
&lt;P&gt;18 %LET _CLIENTTASKLABEL=;&lt;/P&gt;
&lt;P&gt;19 %LET _CLIENTPROJECTPATH=;&lt;/P&gt;
&lt;P&gt;20 %LET _CLIENTPROJECTNAME=;&lt;/P&gt;
&lt;P&gt;21 %LET _SASPROGRAMFILE=;&lt;/P&gt;
&lt;P&gt;22&lt;/P&gt;
&lt;P&gt;23 ;*';*";*/;quit;run;&lt;/P&gt;
&lt;P&gt;24 ODS _ALL_ CLOSE;&lt;/P&gt;
&lt;P&gt;25&lt;/P&gt;
&lt;P&gt;26&lt;/P&gt;
&lt;P&gt;27 QUIT; RUN;&lt;/P&gt;
&lt;P&gt;28&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do I get around this please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Nov 2016 12:01:14 GMT</pubDate>
    <dc:creator>anonymous_user</dc:creator>
    <dc:date>2016-11-16T12:01:14Z</dc:date>
    <item>
      <title>SAS Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-error/m-p/311960#M67573</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have this part of a SAS Macro&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; runmonth=&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(intnx(month,&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(today()),-1),yymmn6.); &lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*Curr Month*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; lastmonth=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;(intnx(month,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;(today()),-2),yymmn6.); &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*Prev Month*/&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; runmonth2=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;(intnx(month,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;(today()),-1),yymmdd10.); &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*Curr Month*/&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; HPIDate=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;(intnx(quarter,"&amp;amp;runmonth."d,0,e),yymmdd10.); &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*last month of previous Qtr*/&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and when I run the HPIDate, I get this error message&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;14 GOPTIONS ACCESSIBLE;&lt;/P&gt;
&lt;P&gt;SYMBOLGEN: Macro variable RUNMONTH resolves to 201610&lt;/P&gt;
&lt;P&gt;ERROR: Argument 2 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number.&lt;/P&gt;
&lt;P&gt;ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list. Execution of %SYSCALL statement or %SYSFUNC&lt;/P&gt;
&lt;P&gt;or %QSYSFUNC function reference is terminated.&lt;/P&gt;
&lt;P&gt;15 %let HPIDate=%sysfunc(intnx(quarter,"&amp;amp;runmonth."d,0,e),yymmdd10.);&lt;/P&gt;
&lt;P&gt;16&lt;/P&gt;
&lt;P&gt;17 GOPTIONS NOACCESSIBLE;&lt;/P&gt;
&lt;P&gt;18 %LET _CLIENTTASKLABEL=;&lt;/P&gt;
&lt;P&gt;19 %LET _CLIENTPROJECTPATH=;&lt;/P&gt;
&lt;P&gt;20 %LET _CLIENTPROJECTNAME=;&lt;/P&gt;
&lt;P&gt;21 %LET _SASPROGRAMFILE=;&lt;/P&gt;
&lt;P&gt;22&lt;/P&gt;
&lt;P&gt;23 ;*';*";*/;quit;run;&lt;/P&gt;
&lt;P&gt;24 ODS _ALL_ CLOSE;&lt;/P&gt;
&lt;P&gt;25&lt;/P&gt;
&lt;P&gt;26&lt;/P&gt;
&lt;P&gt;27 QUIT; RUN;&lt;/P&gt;
&lt;P&gt;28&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do I get around this please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2016 12:01:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-error/m-p/311960#M67573</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2016-11-16T12:01:14Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-error/m-p/311962#M67575</link>
      <description>&lt;P&gt;The literal "201610"d is not a valid date literal. '01oct2016'd would be one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To make your life easier, I recommend to do all the calculations in a data _null_ step and use call symput() to create the macro variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And when I need a date for reference in a macro variable, I simply use the raw number:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let runmonth=%sysfunc(today());&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Can be used anywhere where a date is needed.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2016 12:30:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-error/m-p/311962#M67575</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-11-16T12:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-error/m-p/311964#M67576</link>
      <description>&lt;P&gt;To create hpidate, I'd do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
runmonth = intnx('month',today(),-1);
hpidate = intnx('quarter',runmonth,-1,'e');
call symput('hpidate',put(hpidate,best.));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Nov 2016 12:36:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-error/m-p/311964#M67576</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-11-16T12:36:24Z</dc:date>
    </item>
  </channel>
</rss>

