<?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 Increment months by macros do loop in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Increment-months-by-macros-do-loop/m-p/268655#M53194</link>
    <description>Hi, I need to create a dataset for each month for each branch with all d transactions. So I need to create automatically increment the months up to 12 months in one macro . Please provide your suggestions. I tried creating do loop but not able to calculate character value in evaluating function. Thanks in advance. Waiting for your tips</description>
    <pubDate>Thu, 05 May 2016 19:42:19 GMT</pubDate>
    <dc:creator>NagendraBS</dc:creator>
    <dc:date>2016-05-05T19:42:19Z</dc:date>
    <item>
      <title>Increment months by macros do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Increment-months-by-macros-do-loop/m-p/268655#M53194</link>
      <description>Hi, I need to create a dataset for each month for each branch with all d transactions. So I need to create automatically increment the months up to 12 months in one macro . Please provide your suggestions. I tried creating do loop but not able to calculate character value in evaluating function. Thanks in advance. Waiting for your tips</description>
      <pubDate>Thu, 05 May 2016 19:42:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Increment-months-by-macros-do-loop/m-p/268655#M53194</guid>
      <dc:creator>NagendraBS</dc:creator>
      <dc:date>2016-05-05T19:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: Increment months by macros do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Increment-months-by-macros-do-loop/m-p/268662#M53195</link>
      <description>&lt;P&gt;Use the INTNX function. It's not exactly clear what you want, but maybe this will help you get started.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro loop;

%do i=1 %to 12;

%let date=%sysfunc(intnx(month, %sysfunc(today()), &amp;amp;i.), date9.);

%put &amp;amp;date.;

%end;

%mend;

%loop;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 May 2016 19:53:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Increment-months-by-macros-do-loop/m-p/268662#M53195</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-05T19:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: Increment months by macros do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Increment-months-by-macros-do-loop/m-p/268667#M53197</link>
      <description>&lt;P&gt;My best tip:&amp;nbsp; write a program with no macro language, that works for a single month.&amp;nbsp; Then we can worry about how to make it loop over a set of months.&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2016 20:07:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Increment-months-by-macros-do-loop/m-p/268667#M53197</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-05-05T20:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: Increment months by macros do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Increment-months-by-macros-do-loop/m-p/268685#M53203</link>
      <description>&lt;P&gt;My first thing involving any time, date or datetime related issue: Make sure the values are SAS time, date or datetime valued variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You don't say what you are going to do with multiple datasets but I bet it compounds doing more looping, macro or otherwise. Formats for the date variables can create very useable groups. Here's a very simple example. The first data step is just to create some dummy data for the proc tabulate to demonstrate creating a report with separate sections for the branch and totals by month.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data example;
   length account $ 15;
   do branch = 'A','B','C';
      do num = 1001 to 1005;
         account= cats(branch,num);
         do date = '01jan2015'd to '15jul2015'd by 20;
            deposit = round(1000*ranuni(456),.01);
            output;
         end;
      end;
   end;
run;

proc tabulate data=example;
   class branch date;
   format date monyy7.;
   var deposit;
   tables branch,
          date='Month',
          Deposit*sum*f=dollar10.2
          ;
run;
         &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can get similar results from proc means, freq, summary and report&amp;nbsp;using formats on a single date varible. Also most of the modeling procedures will honor the format for creating levels of modeled variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2016 21:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Increment-months-by-macros-do-loop/m-p/268685#M53203</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-05-05T21:16:44Z</dc:date>
    </item>
  </channel>
</rss>

