<?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: Splitting one row with two dates into multiple rows by month in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Splitting-one-row-with-two-dates-into-multiple-rows-by-month/m-p/722951#M224262</link>
    <description>&lt;P&gt;Use the &lt;A href="https://sasnrd.com/sas-date-examples-intnx-intck/" target="_self"&gt;Intnx Function&lt;/A&gt; like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input (Var1 Var2)(:mmddyy10.);
format Var: mmddyy10.;
datalines;
01/01/2019 06/30/2019
;

data want(drop = i);
   set have;
   do i = 0 by 1 while (1);
      dt = intnx('month', Var1, i, 'b');
      if dt &amp;gt; Var2 then leave;
      output;
   end;

   format dt yymmn6.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Mar 2021 11:07:29 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2021-03-04T11:07:29Z</dc:date>
    <item>
      <title>Splitting one row with two dates into multiple rows by month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-one-row-with-two-dates-into-multiple-rows-by-month/m-p/722946#M224261</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table with two date variables that make a date range (as an example, Var1 is 01/01/2019 and Var2 is 06/30/2019). I want to take that rows and split it into multiple rows, with a row for each month within the date range. Thus in the example I have, the one record would be split into six records (201901, 201902, 201903, etc..). I know this is somehow possible with the INTCK and INTNX function and using some kind of loop, but I can not figure out how to use them properly to get the results I want. Any help would be appreciated, thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 19:01:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-one-row-with-two-dates-into-multiple-rows-by-month/m-p/722946#M224261</guid>
      <dc:creator>Sas_Act_114</dc:creator>
      <dc:date>2021-03-02T19:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting one row with two dates into multiple rows by month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-one-row-with-two-dates-into-multiple-rows-by-month/m-p/722951#M224262</link>
      <description>&lt;P&gt;Use the &lt;A href="https://sasnrd.com/sas-date-examples-intnx-intck/" target="_self"&gt;Intnx Function&lt;/A&gt; like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input (Var1 Var2)(:mmddyy10.);
format Var: mmddyy10.;
datalines;
01/01/2019 06/30/2019
;

data want(drop = i);
   set have;
   do i = 0 by 1 while (1);
      dt = intnx('month', Var1, i, 'b');
      if dt &amp;gt; Var2 then leave;
      output;
   end;

   format dt yymmn6.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 11:07:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-one-row-with-two-dates-into-multiple-rows-by-month/m-p/722951#M224262</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-03-04T11:07:29Z</dc:date>
    </item>
  </channel>
</rss>

