<?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: Output to dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Output-to-dataset/m-p/498480#M132478</link>
    <description>Thanks.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 24 Sep 2018 17:33:31 GMT</pubDate>
    <dc:creator>BhargavDesai</dc:creator>
    <dc:date>2018-09-24T17:33:31Z</dc:date>
    <item>
      <title>Output to dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-to-dataset/m-p/498474#M132476</link>
      <description>&lt;P&gt;How do I output this to a dataset?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial, Helvetica, Verdana, sans-serif; font-size: small; font-style: normal; font-weight: 400; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;This example shows how to use macro logic and a macro %DO loop to loop through a starting and ending date.&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;
&lt;PRE style="margin: 0px; padding: 10px 0px 8px; border: 0px currentColor; border-image: none; text-align: left; color: rgb(51, 51, 51); text-transform: none; line-height: 1.25em; text-indent: 0px; letter-spacing: normal; font-family: monospace; font-style: normal; font-weight: 400; word-spacing: 0px; orphans: 2; widows: 2; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;CODE style="margin: 0px; padding: 10px 0px 8px; border: 0px currentColor; border-image: none; text-align: left; line-height: 1.25em; font-family: monospace; font-style: normal; font-weight: normal;"&gt;
%macro date_loop(start,end);
/*converts the dates to SAS dates*/
%let start=%sysfunc(inputn(&amp;amp;start,anydtdte9.));
%let end=%sysfunc(inputn(&amp;amp;end,anydtdte9.));
/*determines the number of months between the two dates*/
%let dif=%sysfunc(intck(month,&amp;amp;start,&amp;amp;end));
%do i=0 %to &amp;amp;dif;
/*advances the date i months from the start date and applys the DATE9. format*/
  %let date=%sysfunc(putn(%sysfunc(intnx(month,&amp;amp;start,&amp;amp;i,b)),date9.));
  %put &amp;amp;date;
%end;
%mend;

%date_loop(01jun2008,01sep2009)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Sep 2018 17:14:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-to-dataset/m-p/498474#M132476</guid>
      <dc:creator>BhargavDesai</dc:creator>
      <dc:date>2018-09-24T17:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: Output to dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-to-dataset/m-p/498476#M132477</link>
      <description>&lt;P&gt;You would do that in a data step, not in macro logic. I've left the macro variables but that isn't needed either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let start="01Jan2018"d;
%let end="01Dec2018"d;

data want;
n_intervals = intck('month', &amp;amp;start, &amp;amp;end);

do i=0 to n_intervals;
   date = intnx('month', &amp;amp;start, i, 'b');
    output;
end;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/49961"&gt;@BhargavDesai&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;How do I output this to a dataset?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="text-align: left; color: #333333; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Arial, Helvetica, Verdana, sans-serif; font-size: small; font-style: normal; font-weight: 400; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;This example shows how to use macro logic and a macro %DO loop to loop through a starting and ending date.&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;
&lt;PRE style="margin: 0px; padding: 10px 0px 8px; border: 0px currentColor; text-align: left; color: #333333; text-transform: none; line-height: 1.25em; text-indent: 0px; letter-spacing: normal; font-family: monospace; font-style: normal; font-weight: 400; word-spacing: 0px; orphans: 2; widows: 2; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;CODE style="margin: 0px; padding: 10px 0px 8px; border: 0px currentColor; text-align: left; line-height: 1.25em; font-family: monospace; font-style: normal; font-weight: normal;"&gt;
%macro date_loop(start,end);
/*converts the dates to SAS dates*/
%let start=%sysfunc(inputn(&amp;amp;start,anydtdte9.));
%let end=%sysfunc(inputn(&amp;amp;end,anydtdte9.));
/*determines the number of months between the two dates*/
%let dif=%sysfunc(intck(month,&amp;amp;start,&amp;amp;end));
%do i=0 %to &amp;amp;dif;
/*advances the date i months from the start date and applys the DATE9. format*/
  %let date=%sysfunc(putn(%sysfunc(intnx(month,&amp;amp;start,&amp;amp;i,b)),date9.));
  %put &amp;amp;date;
%end;
%mend;

%date_loop(01jun2008,01sep2009)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Sep 2018 17:21:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-to-dataset/m-p/498476#M132477</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-24T17:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Output to dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-to-dataset/m-p/498480#M132478</link>
      <description>Thanks.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 24 Sep 2018 17:33:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-to-dataset/m-p/498480#M132478</guid>
      <dc:creator>BhargavDesai</dc:creator>
      <dc:date>2018-09-24T17:33:31Z</dc:date>
    </item>
  </channel>
</rss>

