<?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 Macro Loop in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-Loop/m-p/324242#M71965</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have 3 years worth of datasets called mort_201401, mort_201402 etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need help in creating a loop/macro so that my Data step will pull all the QUARTER END MONTHS ONLY. Does anyone have an idea how I can do this please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I would like another loop/macro to always work out what the last 3 quarter months are and extract that data automatically, is that possible? So if i didn't run for 5 months, it would automatically calculate the quarter month end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
    <pubDate>Thu, 12 Jan 2017 14:08:38 GMT</pubDate>
    <dc:creator>anonymous_user</dc:creator>
    <dc:date>2017-01-12T14:08:38Z</dc:date>
    <item>
      <title>Macro Loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Loop/m-p/324242#M71965</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have 3 years worth of datasets called mort_201401, mort_201402 etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need help in creating a loop/macro so that my Data step will pull all the QUARTER END MONTHS ONLY. Does anyone have an idea how I can do this please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I would like another loop/macro to always work out what the last 3 quarter months are and extract that data automatically, is that possible? So if i didn't run for 5 months, it would automatically calculate the quarter month end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2017 14:08:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Loop/m-p/324242#M71965</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2017-01-12T14:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Loop/m-p/324249#M71968</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are trying to read from all those table at once, you could gather their names through the dictionary tables (system tables) store the list into a macro var and from there access those from a data step, like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;proc sql noprint;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;select memname into :_TABLES separated by ' ' from dictionary.tables &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;where upcase(libname) = 'DATALIB' and index(upcase(memname),'MORT_') eq 1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;%put tables list: &amp;amp;_TABLES;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;data want;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;set &amp;amp;_TABLES; * access all tables;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt; do whatever you need to do here &amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;SPAN&gt;Could you give us an example for part 2 of your question?&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;SPAN&gt;Hope it helps.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;SPAN&gt;Daniel Santos&amp;nbsp;@ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2017 14:16:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Loop/m-p/324249#M71968</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2017-01-12T14:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Loop/m-p/324251#M71969</link>
      <description>&lt;P&gt;As always, no need for macro, use&amp;nbsp;&lt;STRONG&gt;Base SAS&lt;/STRONG&gt; which is the programming language.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;data want;
  set mort_: indsname=tmp;
  if substr(indsname,10,2) in ("01","04","07","12") then output;
run;&lt;/PRE&gt;
&lt;P&gt;Update the in () to refelect what the end of quarter is for you, I just assumed 1, 4, 7, 12 months.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2017 14:24:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Loop/m-p/324251#M71969</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-01-12T14:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Loop/m-p/324259#M71972</link>
      <description>&lt;P&gt;Unless you are still running 9.1.3, which is my case... &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;set mort_: indsname=tmp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I really miss this feature which is new in 9.2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel Santos&amp;nbsp;@ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2017 14:41:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Loop/m-p/324259#M71972</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2017-01-12T14:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Loop/m-p/324260#M71973</link>
      <description>&lt;P&gt;But then your likely bashing code into stone with with a chisel&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Seriously, no reason to hang back on later versions, only big player is 32bit versus 64bit which is a debacle.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2017 14:44:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Loop/m-p/324260#M71973</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-01-12T14:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Loop/m-p/324284#M71978</link>
      <description>&lt;P&gt;Oh yes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We've got ourselves a weird situation here... Stuck with a 9.1.3 Metadata server because of custom made plugins which aren't supported on later versions... Still the batch server is 9.4&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Developing like 10 years ago, and running it like today &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;Daniel Santos&amp;nbsp;@ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2017 15:39:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Loop/m-p/324284#M71978</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2017-01-12T15:39:20Z</dc:date>
    </item>
  </channel>
</rss>

