<?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: Date Variable to be put into macro in %let. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-Variable-to-be-put-into-macro-in-let/m-p/217309#M40027</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you use INTNX in a SQL or data step it requires the quotes. The macro processor requires no quotes. This is true of other text parameters for functions as well, not just iNTNX. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Apr 2015 16:33:11 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-04-07T16:33:11Z</dc:date>
    <item>
      <title>Date Variable to be put into macro in %let.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Variable-to-be-put-into-macro-in-let/m-p/217306#M40024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, All,&lt;/P&gt;&lt;P&gt;Based on the current date batch I have (20120229) I want to go back 24 months and grab the month end (20100228).&lt;/P&gt;&lt;P&gt;Right now, I can do it with INTNX and CALL SYMPUT. At the same time, I want to do the same thing with %let. However, &lt;/P&gt;&lt;P&gt;I am a little lost and confused and don't know how to get it. &lt;/P&gt;&lt;P&gt;Please offer suggestions if you can, Thanks.&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*WORKING*/&lt;/P&gt;&lt;P&gt;%let batch=20120229;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;oldbatch=INTNX('month',input (put(&amp;amp;batch,8.), YYMMDD8.),-24, 'end');&lt;/P&gt;&lt;P&gt;call symput ('batch2',trim(left(put(oldbatch,yymmddn8.))));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%put check the value of: &amp;amp;batch2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*NOT WORKING*/&lt;/P&gt;&lt;P&gt;%let batch_c= %sysfunc (putn(&amp;amp;batch,8.));&lt;/P&gt;&lt;P&gt;%let batch_d= %sysfunc (inputn(&amp;amp;batch_c,YYMMDD8.));&lt;/P&gt;&lt;P&gt;%let batch3=&amp;nbsp; %sysfunc(intnx('month', &amp;amp;batch_d, -24, 'end'));;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put check the value of: &amp;amp;batch_c, &amp;amp;batch_d, &amp;amp;batch3;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2015 15:18:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Variable-to-be-put-into-macro-in-let/m-p/217306#M40024</guid>
      <dc:creator>jiangmi</dc:creator>
      <dc:date>2015-04-07T15:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: Date Variable to be put into macro in %let.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Variable-to-be-put-into-macro-in-let/m-p/217307#M40025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't need the quotes around the month/end in your last batch3 macro variable declaration, and apply your format in the %sysfunc otherwise it's a SAS date so a number. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;57&amp;nbsp;&amp;nbsp; %let batch=20120229;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;58&amp;nbsp;&amp;nbsp; %let batch_c= %sysfunc (putn(&amp;amp;batch,8.));&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;59&amp;nbsp;&amp;nbsp; %let batch_d= %sysfunc (inputn(&amp;amp;batch_c,YYMMDD8.));&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;60&amp;nbsp;&amp;nbsp; %let batch3=&amp;nbsp; %sysfunc(intnx(month, &amp;amp;batch_d, -24, end), yymmddn8.);;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;61&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;62&amp;nbsp;&amp;nbsp; %put check the value of: &amp;amp;batch_c, &amp;amp;batch_d, &amp;amp;batch3;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;check the value of: 20120229, 19052, 20100228&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2015 15:23:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Variable-to-be-put-into-macro-in-let/m-p/217307#M40025</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-04-07T15:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: Date Variable to be put into macro in %let.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Variable-to-be-put-into-macro-in-let/m-p/217308#M40026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Reeza,&lt;/P&gt;&lt;P&gt;It works now.&lt;/P&gt;&lt;P&gt;I am not good with sas dates. I actually checked the online document about INTNX: &lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p10v3sa3i4kfxfn1sovhi5xzxh8n.htm" title="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p10v3sa3i4kfxfn1sovhi5xzxh8n.htm"&gt;SAS(R) 9.3 Functions and CALL Routines: Reference&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and copied a sample into my code. In the sample, they had quotes.&lt;/P&gt;&lt;P&gt;Anyway, Thanks a lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2015 15:37:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Variable-to-be-put-into-macro-in-let/m-p/217308#M40026</guid>
      <dc:creator>jiangmi</dc:creator>
      <dc:date>2015-04-07T15:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: Date Variable to be put into macro in %let.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Variable-to-be-put-into-macro-in-let/m-p/217309#M40027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you use INTNX in a SQL or data step it requires the quotes. The macro processor requires no quotes. This is true of other text parameters for functions as well, not just iNTNX. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2015 16:33:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Variable-to-be-put-into-macro-in-let/m-p/217309#M40027</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-04-07T16:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: Date Variable to be put into macro in %let.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Variable-to-be-put-into-macro-in-let/m-p/217310#M40028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the clarification.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2015 17:31:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Variable-to-be-put-into-macro-in-let/m-p/217310#M40028</guid>
      <dc:creator>jiangmi</dc:creator>
      <dc:date>2015-04-07T17:31:34Z</dc:date>
    </item>
  </channel>
</rss>

