<?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: Macro programming for numeric date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-programming-for-numeric-date/m-p/318340#M69740</link>
    <description>&lt;P&gt;If you are going to do any manipulation of dates, intervals between two dates or increment dates then you want to put the values into&amp;nbsp; SAS date valued variables so the functions INTNX and INTCK are available. &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp;shows how. You really do not want to attempt to manipulate date values in the macro language as the syntax gets very ugly, hard to read and fragile. Use a datastep and then assign the value of the dates to macro variables using SYMPUTX.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Dec 2016 18:16:12 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-12-12T18:16:12Z</dc:date>
    <item>
      <title>Macro programming for numeric date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-programming-for-numeric-date/m-p/318305#M69720</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following format for date in a table 20161031 (numeric).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which is the best way to create the last 1 (20161024), 2 (20161017) weeks in the same format so as to put them in a macro element?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to perform some computations between the given periods but i would like to establish a more dynamic procedure for future use.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2016 16:09:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-programming-for-numeric-date/m-p/318305#M69720</guid>
      <dc:creator>ConsAth</dc:creator>
      <dc:date>2016-12-12T16:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: Macro programming for numeric date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-programming-for-numeric-date/m-p/318308#M69722</link>
      <description>&lt;P&gt;If your date variable is a number like 20161031 then you need to convert it&lt;/P&gt;
&lt;P&gt;into a sas date as in next demo&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;data _null_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dtn = 20161031;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;date _var = input(dtn,yymmdd8.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;run;&lt;/P&gt;
&lt;P&gt;In case the date variable is a sas date, then just subtrcat 7 from the date to get the previous same day of week:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;data _null_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; date_var = '31OCT2016'd;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; date_1 = date_var - 7;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; date_2 = date_var - 14;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;put date_var ddmmyy10. &amp;nbsp; date_1 ddmmyy10. &amp;nbsp; date_2 ddmmyy10. ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2016 16:20:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-programming-for-numeric-date/m-p/318308#M69722</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-12-12T16:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: Macro programming for numeric date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-programming-for-numeric-date/m-p/318340#M69740</link>
      <description>&lt;P&gt;If you are going to do any manipulation of dates, intervals between two dates or increment dates then you want to put the values into&amp;nbsp; SAS date valued variables so the functions INTNX and INTCK are available. &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp;shows how. You really do not want to attempt to manipulate date values in the macro language as the syntax gets very ugly, hard to read and fragile. Use a datastep and then assign the value of the dates to macro variables using SYMPUTX.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2016 18:16:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-programming-for-numeric-date/m-p/318340#M69740</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-12-12T18:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: Macro programming for numeric date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-programming-for-numeric-date/m-p/318353#M69744</link>
      <description>&lt;P&gt;Thank you very much for your replies, i usually incorporate dates in datetime into macros and using INTCK and INTNX functions but these type of date in numeric form gave me trouble because after put in a macro it wasnt beeing resolved&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2016 19:24:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-programming-for-numeric-date/m-p/318353#M69744</guid>
      <dc:creator>ConsAth</dc:creator>
      <dc:date>2016-12-12T19:24:32Z</dc:date>
    </item>
  </channel>
</rss>

