<?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: creating a column of months with a do loop in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/creating-a-column-of-months-with-a-do-loop/m-p/591524#M169463</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/264394"&gt;@akosyan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please help me with this ask ?&lt;/P&gt;
&lt;P&gt;So I have&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let start_month = 1801&lt;/P&gt;
&lt;P&gt;%let end_month = 1907&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to create a datatable containing only one column which will have all the months from start to end. I am assuming I should append a new month values in a do loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Don't bother with macros.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    startmonth='01JAN18'd;
    endmonth='01JUL19'd;
    month=startmonth;
    do while(month le endmonth);
        output;
        month=intnx('month',month,1);
    end;
    keep month;
    format month yymm5.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 25 Sep 2019 13:46:12 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2019-09-25T13:46:12Z</dc:date>
    <item>
      <title>creating a column of months with a do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-column-of-months-with-a-do-loop/m-p/591518#M169458</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help me with this ask ?&lt;/P&gt;&lt;P&gt;So I have&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let start_month = 1801&lt;/P&gt;&lt;P&gt;%let end_month = 1907&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a datatable containing only one column which will have all the months from start to end. I am assuming I should append a new month values in a do loop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 13:39:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-column-of-months-with-a-do-loop/m-p/591518#M169458</guid>
      <dc:creator>akosyan</dc:creator>
      <dc:date>2019-09-25T13:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: creating a column of months with a do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-column-of-months-with-a-do-loop/m-p/591522#M169461</link>
      <description>&lt;P&gt;Hi and welcome to the SAS Community &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does 1801 represent january in 2018?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 13:41:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-column-of-months-with-a-do-loop/m-p/591522#M169461</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-09-25T13:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: creating a column of months with a do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-column-of-months-with-a-do-loop/m-p/591523#M169462</link>
      <description>&lt;P&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;yes 1801 is January 2018,&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 13:42:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-column-of-months-with-a-do-loop/m-p/591523#M169462</guid>
      <dc:creator>akosyan</dc:creator>
      <dc:date>2019-09-25T13:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: creating a column of months with a do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-column-of-months-with-a-do-loop/m-p/591524#M169463</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/264394"&gt;@akosyan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please help me with this ask ?&lt;/P&gt;
&lt;P&gt;So I have&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let start_month = 1801&lt;/P&gt;
&lt;P&gt;%let end_month = 1907&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to create a datatable containing only one column which will have all the months from start to end. I am assuming I should append a new month values in a do loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Don't bother with macros.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    startmonth='01JAN18'd;
    endmonth='01JUL19'd;
    month=startmonth;
    do while(month le endmonth);
        output;
        month=intnx('month',month,1);
    end;
    keep month;
    format month yymm5.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Sep 2019 13:46:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-column-of-months-with-a-do-loop/m-p/591524#M169463</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-09-25T13:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: creating a column of months with a do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-column-of-months-with-a-do-loop/m-p/591527#M169465</link>
      <description>&lt;P&gt;Thanks Paige,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked, except for the formatting I needed to put yymmn4.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 13:47:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-column-of-months-with-a-do-loop/m-p/591527#M169465</guid>
      <dc:creator>akosyan</dc:creator>
      <dc:date>2019-09-25T13:47:40Z</dc:date>
    </item>
  </channel>
</rss>

