<?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 Re: Calling INTNX from %sysfunc in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15208#M1981</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your prompt reply. You're awesome!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Apr 2012 19:05:42 GMT</pubDate>
    <dc:creator>JatinRai</dc:creator>
    <dc:date>2012-04-24T19:05:42Z</dc:date>
    <item>
      <title>Calling INTNX from %sysfunc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15200#M1973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sure I'll feel like an idiot once I get the answer but, hey, cheap and easy points to the first correct answer &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to convert this expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where clmDt &amp;lt; max(intnx('week1.6',(today()-1),0), intnx('month',today(),-1,'e'));&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;into "pure" macro so the SPDE engine can optimize the where clause.&amp;nbsp; Plus it's really bad form to use functions in a where clause if the value never changes.&amp;nbsp; Finally, for reasons dealing with macros and code generation, I can't just call this data step at the beginning of my program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* test code ; &lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp; x=max(intnx('week1.6',(today()-1),0), intnx('month',today(),-1,'e'));&lt;BR /&gt;&amp;nbsp; call symputx("where",x);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%let where=clmDt &amp;lt; &amp;amp;where;&lt;BR /&gt;%put &amp;amp;where;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* pure macro equivalent? ;&lt;/P&gt;&lt;P&gt;%let today=%sysfunc(today());&lt;BR /&gt;%let friday=%sysfunc(intnx('week1.6',(&amp;amp;today-1),0));&lt;BR /&gt;%let eom=%sysfunc(intnx('month',&amp;amp;today,-1,'e'));&lt;BR /&gt;%let max=%sysfunc(max(&amp;amp;friday,&amp;amp;eom));&lt;BR /&gt;%let where=clmDt &amp;lt; &amp;amp;max;&lt;BR /&gt;%put &amp;amp;where;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but the macro code barfs on the calls to intnx.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Trying something simpler:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp; x=intnx('year',0,0,'E');&lt;BR /&gt;&amp;nbsp; put x= x=date9.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put %sysfunc(intnx('year',0,0,'E'));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;still fails.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The oh-so-helpful error message is:&lt;/P&gt;&lt;P&gt;WARNING: An argument to the function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out of range.&lt;/P&gt;&lt;P&gt;NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The result&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; of the operations have been set to a missing value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which argument to INTNX is out of range?&amp;nbsp; 'year', 0, 0, or 'E'?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 03:02:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15200#M1973</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2011-09-23T03:02:12Z</dc:date>
    </item>
    <item>
      <title>Calling INTNX from %sysfunc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15201#M1974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Scott,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just after you first datastep you have the following line:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eef4f9;"&gt;%let where=clmDt &amp;lt; &amp;amp;where;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eef4f9;"&gt;Where does clmDt come from?&amp;nbsp; It doesn't appear to be part of a datastep.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eef4f9;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 03:17:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15201#M1974</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-23T03:17:51Z</dc:date>
    </item>
    <item>
      <title>Calling INTNX from %sysfunc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15202#M1975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Scott,&lt;/P&gt;&lt;P&gt;Take the quotations out of your macro code and it will work fine:&lt;/P&gt;&lt;PRE&gt; * pure macro equivalent? ;
%let today=%sysfunc(today());
%let friday=%sysfunc(intnx(week1.6,(&amp;amp;today-1),0));
%let eom=%sysfunc(intnx(month,&amp;amp;today,-1,e));
%let max=%sysfunc(max(&amp;amp;friday,&amp;amp;eom));
%let where=clmDt &amp;lt; &amp;amp;max;
%put &amp;amp;where;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 03:23:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15202#M1975</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2011-09-23T03:23:15Z</dc:date>
    </item>
    <item>
      <title>Calling INTNX from %sysfunc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15203#M1976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Art,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The where clause criteria is stored in a metadata file (Excel worksheet), and a macro uses the metadata to generate a "big SAS job".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The "big SAS job" (not mentioned in my original post) subsets the fact table on:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where clmDt &amp;lt;= max( intnx('week1.6',(today()-1),0) , intnx('month',today(),-1,'e'));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to convert that to the equivalent number, without using the functions in the where clause.&amp;nbsp; So, on today, 23Sep11, that would be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where clmDt &amp;lt;= 18886;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Later in the "big SAS job", there is the line:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where &amp;amp;where;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which does the subsetting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know, the easy thing is to just call the data _null_ code before the beginning of my job.&amp;nbsp; But, because of the code generation process mentioned above, it will slot into our current framework easier if I can use a "pure macro" solution to add this to the job metadata.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 03:31:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15203#M1976</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2011-09-23T03:31:48Z</dc:date>
    </item>
    <item>
      <title>Calling INTNX from %sysfunc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15204#M1977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, don't I feel like an idiot ;-).&amp;nbsp; I should have thought of that, and I've done this very thing in other macros in the past. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My brain isn't working too well this Friday!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 03:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15204#M1977</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2011-09-23T03:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calling INTNX from %sysfunc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15205#M1978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;(I don't seem to have the links to mark this Answered or give you the Correct Answer points...I'm using Opera on the Mac if that matters...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit:&amp;nbsp; Yep, the website doesn't have complete functionality when using Opera.&amp;nbsp; Firefox worked...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Scott Bass&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 03:44:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15205#M1978</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2011-09-23T03:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calling INTNX from %sysfunc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15206#M1979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Awesome response SASJedi. You saved me several minutes. But why do we remove the quotes? What is the logic or thumb rule applicable here when the original syntax uses quotes. I'm interested to know the general principle behind this because as Scott says that he has used this in other macros as well. So where all am I expected to remove the quotes?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Apr 2012 18:30:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15206#M1979</guid>
      <dc:creator>JatinRai</dc:creator>
      <dc:date>2012-04-24T18:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: Calling INTNX from %sysfunc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15207#M1980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad to be able to help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; When calling DATA step function from MACRO using %SYSFUNC, the general rule is to always leave out the quotes.&amp;nbsp; Macro doesn't use quotes to mark text like the DATA step does, and even though you are calling a DATA step function, the processing is in MACRO, not DATA step, so the quotes will usually just mess things up. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wish I could tell you this was a 100% hard and fast rule for all occasions, but I hate to lie... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; I &lt;EM&gt;know&lt;/EM&gt; I've had to insert quotes for the argument of a DATA step function on some odd, rare occasion - but I just can't for the life of me remember what it was right now.&amp;nbsp; Just remember: always try it WITHOUT the quotes first - that way, most everything will work the first time you try it without issues.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Apr 2012 18:53:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15207#M1980</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2012-04-24T18:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calling INTNX from %sysfunc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15208#M1981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your prompt reply. You're awesome!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Apr 2012 19:05:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-INTNX-from-sysfunc/m-p/15208#M1981</guid>
      <dc:creator>JatinRai</dc:creator>
      <dc:date>2012-04-24T19:05:42Z</dc:date>
    </item>
  </channel>
</rss>

