<?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: Looping through macros in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Looping-through-macros/m-p/567872#M159751</link>
    <description>&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; want&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; students_201001 - students_201910 &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jun 2019 11:13:54 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2019-06-21T11:13:54Z</dc:date>
    <item>
      <title>Looping through macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-through-macros/m-p/567722#M159683</link>
      <description>&lt;P&gt;I want to make a union of all datasets from 2010-2019 whcih are named like students_201001, students_201002....students_201012.....students_201905.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was using a nested loop one for year and other for moth, but it is not working:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro join;&lt;BR /&gt;%Do i=2010 %to 2019;&lt;BR /&gt;%DO j=01 %TO 12;&lt;BR /&gt;data append_recov_&amp;amp;i&amp;amp;j;&lt;BR /&gt;set chi_perf.perf_chi_&amp;amp;i&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;BR /&gt;%end;&lt;BR /&gt;%mend;&lt;BR /&gt;%join;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 18:20:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-through-macros/m-p/567722#M159683</guid>
      <dc:creator>yashij2138</dc:creator>
      <dc:date>2019-06-20T18:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-through-macros/m-p/567725#M159685</link>
      <description>&lt;P&gt;There's a much simpler way by using wildcards:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set students_201:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Jun 2019 18:30:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-through-macros/m-p/567725#M159685</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-20T18:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-through-macros/m-p/567731#M159691</link>
      <description>&lt;P&gt;The iterative %DO loop will convert your values into numbers and then back to strings to assign to the loop variable.&lt;/P&gt;
&lt;P&gt;So %DO j=01 %to 12 will set J to 1,2,3,4,5,6,7,8,9,10,11,12.&lt;/P&gt;
&lt;P&gt;If you want to convert the values less than 10 to 2 digits try using the PUTN() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%do j=01 %to 12;
  %let j=%sysfunc(putn(&amp;amp;j,z2.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 18:46:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-through-macros/m-p/567731#M159691</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-20T18:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-through-macros/m-p/567792#M159715</link>
      <description>&lt;P&gt;An easy way to get YYYYMM is to create a third macro variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%do y=2010 %to 2019;
   %do m = 1 %to 12;
      %let ym = %eval(&amp;amp;m + 100 * &amp;amp;y);
      %put The year and month:  &amp;amp;ym;
   %end;
%end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Jun 2019 22:03:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-through-macros/m-p/567792#M159715</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-06-20T22:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-through-macros/m-p/567872#M159751</link>
      <description>&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; want&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; students_201001 - students_201910 &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 11:13:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-through-macros/m-p/567872#M159751</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-06-21T11:13:54Z</dc:date>
    </item>
  </channel>
</rss>

