<?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: Create List of Dates automatically each month in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318079#M69661</link>
    <description>&lt;P&gt;I am new to using macros so I had to do some research. &amp;nbsp;I think I found a solution. &amp;nbsp;You have to use a global statement before the data step and put double quotes around the variable name after the symputx statement. &amp;nbsp;Thanks for your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-story-id="story_329241534fd3f9de1df54afc28b62a62" data-timestamp="1481376152614" data-text="%MACRO month (Y,Z); 
%global M&amp;amp;amp;Y E&amp;amp;amp;Z;
data _null_; 
call symputx(&amp;quot;M&amp;amp;amp;Y&amp;quot;, PUT(intnx('DAY',intnx('MONTH',%SYSFUNC(today()),-1,'b'),&amp;amp;amp;Y), date9.)); 
call symputx(&amp;quot;E&amp;amp;amp;Z&amp;quot;, PUT(intnx('DAY',intnx('MONTH',%SYSFUNC(today()),0,'b'),&amp;amp;amp;Z), date9.)); 
RUN; 
%MEND; " data-userid="603771196974010368" data-orgid="603771196982398977"&gt;%MACRO month (Y,Z); &lt;BR /&gt;%global M&amp;amp;Y E&amp;amp;Z;&lt;BR /&gt;data null; &lt;BR /&gt;call symputx("M&amp;amp;Y", PUT(intnx('DAY',intnx('MONTH',%SYSFUNC(today()),-1,'b'),&amp;amp;Y), date9.)); &lt;BR /&gt;call symputx("E&amp;amp;Z", PUT(intnx('DAY',intnx('MONTH',%SYSFUNC(today()),0,'b'),&amp;amp;Z), date9.)); &lt;BR /&gt;RUN; &lt;BR /&gt;%MEND; &lt;/SPAN&gt;&lt;IMG border="0" /&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 10 Dec 2016 18:44:23 GMT</pubDate>
    <dc:creator>pangea17</dc:creator>
    <dc:date>2016-12-10T18:44:23Z</dc:date>
    <item>
      <title>Create List of Dates automatically each month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318035#M69646</link>
      <description>&lt;P&gt;So, I am trying to create a two lists of dates that change each month.&amp;nbsp; I want to generate for instance Nov 2nd to Nov 29th and Dec 1st to Dec 28.&amp;nbsp; The following month it would be Dec 2nd to Dec 29th and Jan 1st to Jan 28th.&amp;nbsp; These dates need to go into a data step that will create some variables based on these dates.&amp;nbsp; It would be tedious to manually change this every month, so I want to use a macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%MACRO&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; month (Y,Z);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;call symputx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'M'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, PUT(intnx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'DAY'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,intnx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'MONTH'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,&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()),-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'b'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;),&amp;amp;Y), &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;call symputx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'E'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, PUT(intnx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'DAY'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,intnx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'MONTH'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,&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()),&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'b'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;),&amp;amp;Z), &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%MEND&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;%&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;3&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;4&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;3&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;5&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;4&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;6&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;5&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;7&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;6&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;%&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;8&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;7&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;9&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;8&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;10&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;9&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;11&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;10&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;12&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;11&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;13&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;12&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;14&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;13&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;%&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;15&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;14&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;16&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;15&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;17&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;16&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;18&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;17&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;19&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;18&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;20&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;19&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;21&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;20&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;%&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;22&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;21&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;23&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;22&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;24&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;23&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;25&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;24&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;26&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;25&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;27&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;26&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;); %&lt;STRONG&gt;&lt;I&gt;month&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;28&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;27&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m5, m16, m17, m18, m19, m20,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;m21, m22, m23, m24, m25, m26, m27, m28, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13,&lt;/P&gt;
&lt;P&gt;e14, e15,e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;into&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;:m1, :m2, :m3, :m4, :m5, :m6, :m7, :m8, :m9, :m10, :m11, :m12, :m13, :m14, :m15, :m16, :m17, :m18, :m19, :m20,&lt;/P&gt;
&lt;P&gt;:m21,:m22, :m23, :m24, :m25, :m26, :m27, :m28, :e1, :e2, :e3, :e4, :e5, :e6, :e7, :e8, :e9, :e10, :e11, :e12,&lt;/P&gt;
&lt;P&gt;:e13, :e14, :e15, :e16, :e17, :e18, :e19, :e20, :e21, :e22, :e23, :e24, :e25, :e26, :e27, :e28&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _null_;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;QUIT&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;My problem is that M and E will be overwritten each time. And SAS will not allow you to have a macro variable name for the 'M' or 'E' in the symputx statements. Otherwise I would just have it read 'M&amp;amp;Y' and 'E&amp;amp;Z' and it would work.&amp;nbsp; Am I going about this the wrong way, or is there a better way to make this work?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Using Enterprise guide 9.4 and SAS 9.1.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Thanks everyone for your help!&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2016 01:00:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318035#M69646</guid>
      <dc:creator>pangea17</dc:creator>
      <dc:date>2016-12-10T01:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: Create List of Dates automatically each month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318036#M69647</link>
      <description>&lt;P&gt;1. Create a dataset with the values that you want - not macro variables. I don't understand your rules for creating the date so I'll wait for clarification on that, if you want code.&lt;/P&gt;
&lt;P&gt;2. Use SQL to create the consecutive macrovariables you want&lt;/P&gt;
&lt;P&gt;3. Then once you've solved this issue (learning/practice) redesign your code to not use 60 macro variables. There has to be a better way...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 2:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select m into :m1-
from data_from_step1;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Step 3: possibly...&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select *
from a
where date in (select m from data_from_step1);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2016 01:09:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318036#M69647</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-10T01:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: Create List of Dates automatically each month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318039#M69649</link>
      <description>&lt;P&gt;If feels that you're going way too complicated about this.There are calendar functions which might help to come up with a simpler approach.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you give us the bigger picture and can explain what you have and what you want to achieve, then may-be we can offer something less complicated.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ideally you provide a data step creating some "have" sample data and then describe the desired output (not only the tables with dates but describe the whole problem you want to solve, so how you're actually using these dates).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2016 01:38:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318039#M69649</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2016-12-10T01:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: Create List of Dates automatically each month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318079#M69661</link>
      <description>&lt;P&gt;I am new to using macros so I had to do some research. &amp;nbsp;I think I found a solution. &amp;nbsp;You have to use a global statement before the data step and put double quotes around the variable name after the symputx statement. &amp;nbsp;Thanks for your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-story-id="story_329241534fd3f9de1df54afc28b62a62" data-timestamp="1481376152614" data-text="%MACRO month (Y,Z); 
%global M&amp;amp;amp;Y E&amp;amp;amp;Z;
data _null_; 
call symputx(&amp;quot;M&amp;amp;amp;Y&amp;quot;, PUT(intnx('DAY',intnx('MONTH',%SYSFUNC(today()),-1,'b'),&amp;amp;amp;Y), date9.)); 
call symputx(&amp;quot;E&amp;amp;amp;Z&amp;quot;, PUT(intnx('DAY',intnx('MONTH',%SYSFUNC(today()),0,'b'),&amp;amp;amp;Z), date9.)); 
RUN; 
%MEND; " data-userid="603771196974010368" data-orgid="603771196982398977"&gt;%MACRO month (Y,Z); &lt;BR /&gt;%global M&amp;amp;Y E&amp;amp;Z;&lt;BR /&gt;data null; &lt;BR /&gt;call symputx("M&amp;amp;Y", PUT(intnx('DAY',intnx('MONTH',%SYSFUNC(today()),-1,'b'),&amp;amp;Y), date9.)); &lt;BR /&gt;call symputx("E&amp;amp;Z", PUT(intnx('DAY',intnx('MONTH',%SYSFUNC(today()),0,'b'),&amp;amp;Z), date9.)); &lt;BR /&gt;RUN; &lt;BR /&gt;%MEND; &lt;/SPAN&gt;&lt;IMG border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2016 18:44:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318079#M69661</guid>
      <dc:creator>pangea17</dc:creator>
      <dc:date>2016-12-10T18:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: Create List of Dates automatically each month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318087#M69664</link>
      <description>&lt;P&gt;Regardless of how you do this (in a data step, or in a macro), you should do it in a loop, which would go from Y=1&amp;nbsp;to 28 and synchroniously from Z=0 to 27.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you're far better off in a data step loop than a macro loop.&amp;nbsp; It&amp;nbsp;will NOT require any use of a macro function (such as %sysfunc).&amp;nbsp; Also note the adding, say 5, to an INTNX function advance the date by exactly 5 days.&amp;nbsp; So there is no need for the "INTNX(date" usage.&amp;nbsp; Just add Y or Z.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  do Y=1 to 28;
    Z=Y-1;
    call symput(cats('M',Y),put(intnx('month',today(),-1,'b')+Y,date9.));
    call symput(cats('E',Z),put(intnx('month',today(),0,'b')+Z,date9.));
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Dec 2016 23:09:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318087#M69664</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2016-12-10T23:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: Create List of Dates automatically each month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318350#M69743</link>
      <description>data _null_;&lt;BR /&gt;25           do Y=1 to 28;&lt;BR /&gt;26             Z=Y-1;&lt;BR /&gt;27             call symput(cats('M',Y),put(intnx('month',today(),-1,'b')+Y,date9.));&lt;BR /&gt;28             call symput(cats('E',Z),put(intnx('month',today(),0,'b')+Z,date9.));&lt;BR /&gt;29           end;&lt;BR /&gt;30         run;&lt;BR /&gt;&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;      real time           0.00 seconds&lt;BR /&gt;      cpu time            0.00 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;31&lt;BR /&gt;32&lt;BR /&gt;33&lt;BR /&gt;34         proc sql;&lt;BR /&gt;35         select m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m5, m16, m17, m18, m19, m20,&lt;BR /&gt;36         m21, m22, m23, m24, m25, m26, m27, m28, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13,&lt;BR /&gt;37         e14, e15,e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28&lt;BR /&gt;38         into&lt;BR /&gt;39         :m1, :m2, :m3, :m4, :m5, :m6, :m7, :m8, :m9, :m10, :m11, :m12, :m13, :m14, :m15, :m16, :m17, :m18, :m19, :m20,&lt;BR /&gt;40         :m21,:m22, :m23, :m24, :m25, :m26, :m27, :m28, :e1, :e2, :e3, :e4, :e5, :e6, :e7, :e8, :e9, :e10, :e11, :e12,&lt;BR /&gt;41         :e13, :e14, :e15, :e16, :e17, :e18, :e19, :e20, :e21, :e22, :e23, :e24, :e25, :e26, :e27, :e28&lt;BR /&gt;42         from _null_;&lt;BR /&gt;ERROR: Table WORK._NULL_ doesn't have any columns. PROC SQL requires each of its tables to have at least 1 column.&lt;BR /&gt;ERROR: The following columns were not found in the contributing tables: e1, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e2,&lt;BR /&gt;       e20, e21, e22, e23, e24, e25, e26, e27, e28, e3, e4, e5, e6, e7, e8, e9, m1, m10, m11, m12, m13, m14, m16, m17, m18, m19,&lt;BR /&gt;       m2, m20, m21, m22, m23, m24, m25, m26, m27, m28, m3, m4, m5, m6, m7, m8, m9.&lt;BR /&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;BR /&gt;43         QUIT;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;      real time           0.00 seconds&lt;BR /&gt;2                                                          The SAS System                            08:30 Monday, December 12, 2016&lt;BR /&gt;&lt;BR /&gt;      cpu time            0.00 seconds&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Dec 2016 19:09:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318350#M69743</guid>
      <dc:creator>pangea17</dc:creator>
      <dc:date>2016-12-12T19:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: Create List of Dates automatically each month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318354#M69745</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15692"&gt;@pangea17&lt;/a&gt;&amp;nbsp;Is there a question in there somewhere?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2016 19:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318354#M69745</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-12T19:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: Create List of Dates automatically each month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318355#M69746</link>
      <description>&lt;P&gt;This code does not work.&amp;nbsp; The output I got is listed below.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2016 19:27:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318355#M69746</guid>
      <dc:creator>pangea17</dc:creator>
      <dc:date>2016-12-12T19:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Create List of Dates automatically each month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318368#M69747</link>
      <description>&lt;P&gt;The code provided works, there's no errors for that portion of the code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CALL SYMPUT creates macro variables. If you check, you'll see your macro variables already exist.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your proc sql step is not required. I suggested this method, but did not provide code for this solution, I'm including it below the other code below. I've added comments to help you understand what's happening in the code. If you have questions, feel free to ask.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, a data _null_ step does not create a data set that you could use to query. The only possible modification I could suggest would be to change the CALL SYMPUT to CALL SYMPUTX.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  do Y=1 to 28; *create indexes for your dates, M series of macro variables;
    Z=Y-1; *create indexes for your dates, E series of macro variables;

   *create M macro variable for for value of Y;
    call symputx(cats('M',Y),put(intnx('month',today(),-1,'b')+Y,date9.));

     *create E macro variable for value of Z;
    call symputx(cats('E',Z),put(intnx('month',today(),0,'b')+Z,date9.));
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Using a data step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dates;
  do Y=1 to 28; *create indexes for your dates, M series of macro variables;
    Z=Y-1; *create indexes for your dates, E series of macro variables;

   *create M macro variable for for value of Y;
    call symputx(cats('M',Y),put(intnx('month',today(),-1,'b')+Y,date9.));

     *create E macro variable for value of Z;
    call symputx(cats('E',Z),put(intnx('month',today(),0,'b')+Z,date9.));

    M=intnx('month',today(),-1,'b')+Y;
    E=intnx('month',today(),0,'b')+Z;


    output;

    format e m date9.;
  end;
run;

proc sql noprint;
select m into :m1-
from dates;

select e into :e1-
from dates;
quit;

%put &amp;amp;m1;
%put &amp;amp;m2;
%put &amp;amp;m28;
%put &amp;amp;e1;
%put &amp;amp;e15;
%put &amp;amp;e28;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2016 20:18:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318368#M69747</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-12T20:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: Create List of Dates automatically each month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318400#M69761</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15692"&gt;@pangea17&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;This code does not work.&amp;nbsp; The output I got is listed below.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No output would be generated for the data _null_ step.&lt;/P&gt;
&lt;P&gt;This will show the macro variables created and their values:&lt;/P&gt;
&lt;PRE&gt;data _null_;
   do Y=1 to 28;
      Z=Y-1;
      call symputx(cats('M',Y),put(intnx('month',today(),-1,'b')+Y,date9.));
      call symputx(cats('E',Z),put(intnx('month',today(),0,'b')+Z,date9.));
   end;
run;

%put _user_;&lt;/PRE&gt;
&lt;P&gt;(plus any other macro variables you have declared ...)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Most of the time working with generated dates there really isn't a good reason to use the date9 or other format unless you are going to have a human read them. If you leave them as the numeric value then you need not do anything like "&amp;amp;M5"d to have them treated as dates elsewhere in code, especially in a data step or sql comparison or assignment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I'm using them as part of a title that people will read, then date9 or such is appropriate.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2016 22:22:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-List-of-Dates-automatically-each-month/m-p/318400#M69761</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-12-12T22:22:44Z</dc:date>
    </item>
  </channel>
</rss>

