<?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 Date Calculation in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-Calculation/m-p/3948#M1660</link>
    <description>Hello, I'm trying to create macros containing the first date of the month for all months in between certain dates (in the case below, it is a calendar year, but this will not be the case every time). &lt;BR /&gt;
The bold part of the program (macro dates_month)is not working for me; I'm not sure why. I'm not concerned with the actual values at this point, I'm just trying to figure out why macros &amp;amp;Date1 - $Date12 are not being created.&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Joe&lt;BR /&gt;
&lt;BR /&gt;
%macro date_calc;&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
Start = put(intnx('month',today(),-14),date9.);&lt;BR /&gt;
call symput('Start',"'"||Start||"'d");&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
firstday = intnx('month',today(),-2);&lt;BR /&gt;
End = put((firstday - 1),date9.);&lt;BR /&gt;
call symput('End',"'"||End||"'d");&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%mend date_calc;&lt;BR /&gt;
%date_calc;&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
MONTH= INTCK('MONTH',&amp;amp;start,&amp;amp;End+1);&lt;BR /&gt;
call symput('MONTH',(Month));&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%put(Start) = &amp;amp;Start;&lt;BR /&gt;
%put(End)   = &amp;amp;End;&lt;BR /&gt;
%put(Month) = &amp;amp;Month;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;%macro dates_month;&lt;BR /&gt;
%do I = 1 %to 12;&lt;BR /&gt;
data _null_;&lt;BR /&gt;
Date&amp;amp;I = intnx('month',&amp;amp;Start,&amp;amp;I);&lt;BR /&gt;
call symput("Date&amp;amp;I",Date&amp;amp;I);&lt;BR /&gt;
run;&lt;BR /&gt;
%end;&lt;BR /&gt;
%mend;&lt;BR /&gt;
%dates_month;&lt;BR /&gt;
&lt;BR /&gt;
%put(Date1) = &amp;amp;Date1;&lt;/B&gt;</description>
    <pubDate>Mon, 23 Jul 2007 15:07:45 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-07-23T15:07:45Z</dc:date>
    <item>
      <title>Date Calculation</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-Calculation/m-p/3948#M1660</link>
      <description>Hello, I'm trying to create macros containing the first date of the month for all months in between certain dates (in the case below, it is a calendar year, but this will not be the case every time). &lt;BR /&gt;
The bold part of the program (macro dates_month)is not working for me; I'm not sure why. I'm not concerned with the actual values at this point, I'm just trying to figure out why macros &amp;amp;Date1 - $Date12 are not being created.&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Joe&lt;BR /&gt;
&lt;BR /&gt;
%macro date_calc;&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
Start = put(intnx('month',today(),-14),date9.);&lt;BR /&gt;
call symput('Start',"'"||Start||"'d");&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
firstday = intnx('month',today(),-2);&lt;BR /&gt;
End = put((firstday - 1),date9.);&lt;BR /&gt;
call symput('End',"'"||End||"'d");&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%mend date_calc;&lt;BR /&gt;
%date_calc;&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
MONTH= INTCK('MONTH',&amp;amp;start,&amp;amp;End+1);&lt;BR /&gt;
call symput('MONTH',(Month));&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%put(Start) = &amp;amp;Start;&lt;BR /&gt;
%put(End)   = &amp;amp;End;&lt;BR /&gt;
%put(Month) = &amp;amp;Month;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;%macro dates_month;&lt;BR /&gt;
%do I = 1 %to 12;&lt;BR /&gt;
data _null_;&lt;BR /&gt;
Date&amp;amp;I = intnx('month',&amp;amp;Start,&amp;amp;I);&lt;BR /&gt;
call symput("Date&amp;amp;I",Date&amp;amp;I);&lt;BR /&gt;
run;&lt;BR /&gt;
%end;&lt;BR /&gt;
%mend;&lt;BR /&gt;
%dates_month;&lt;BR /&gt;
&lt;BR /&gt;
%put(Date1) = &amp;amp;Date1;&lt;/B&gt;</description>
      <pubDate>Mon, 23 Jul 2007 15:07:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-Calculation/m-p/3948#M1660</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-07-23T15:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Date Calculation</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-Calculation/m-p/3949#M1661</link>
      <description>I see you've had a number of very detailed replies on this problem through SAS/L.&lt;BR /&gt;
&lt;BR /&gt;
I presume these will help you resolve your problem.&lt;BR /&gt;
&lt;BR /&gt;
Kind regards&lt;BR /&gt;
&lt;BR /&gt;
David</description>
      <pubDate>Mon, 23 Jul 2007 22:48:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-Calculation/m-p/3949#M1661</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-07-23T22:48:59Z</dc:date>
    </item>
  </channel>
</rss>

