<?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 Sas Macro with Loop in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sas-Macro-with-Loop/m-p/165081#M31892</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So i wanted to create a macro with a loop. Basically what the macro would do is loop through for a certain number of days. The program is made up of a few parts, first a temporary table is created with the data using create table, then i have a code for it to be stored into the DB. I need the macro to loop through it for a X number of days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%Macro....;&lt;/P&gt;&lt;P&gt;%do i=to to &amp;amp;..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;creat table...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data_Null;&lt;/P&gt;&lt;P&gt;set work...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql no print;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%end&lt;/P&gt;&lt;P&gt;%mend datastorage&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This would be the structure of it. However i keep getting the error of&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;ERROR: The following columns were not found in the contributing tables: i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone explain to me if this is possible and what i am doing wrong?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Apr 2014 17:48:41 GMT</pubDate>
    <dc:creator>tonychen1811</dc:creator>
    <dc:date>2014-04-02T17:48:41Z</dc:date>
    <item>
      <title>Sas Macro with Loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-Macro-with-Loop/m-p/165081#M31892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So i wanted to create a macro with a loop. Basically what the macro would do is loop through for a certain number of days. The program is made up of a few parts, first a temporary table is created with the data using create table, then i have a code for it to be stored into the DB. I need the macro to loop through it for a X number of days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%Macro....;&lt;/P&gt;&lt;P&gt;%do i=to to &amp;amp;..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;creat table...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data_Null;&lt;/P&gt;&lt;P&gt;set work...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql no print;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%end&lt;/P&gt;&lt;P&gt;%mend datastorage&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This would be the structure of it. However i keep getting the error of&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;ERROR: The following columns were not found in the contributing tables: i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone explain to me if this is possible and what i am doing wrong?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2014 17:48:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-Macro-with-Loop/m-p/165081#M31892</guid>
      <dc:creator>tonychen1811</dc:creator>
      <dc:date>2014-04-02T17:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: Sas Macro with Loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-Macro-with-Loop/m-p/165082#M31893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What's possible?&lt;/P&gt;&lt;P&gt;Sorry, your question is extremely vague and its hard to comment on it.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;But overall, yes its possible, but it might not be the best solution for your problem anyways.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;EDIT:&lt;/P&gt;&lt;P&gt;If you're looping through a macro make sure you're using&lt;/P&gt;&lt;P&gt;%do %to %if %else etc to control execution&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2014 19:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-Macro-with-Loop/m-p/165082#M31893</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-04-02T19:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Sas Macro with Loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-Macro-with-Loop/m-p/165083#M31894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your error makes me believe that you are trying to reference the intended macro variable i, which you should reference as &amp;amp;i, in a position in the sql code where a variable from a table is expected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2014 20:34:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-Macro-with-Loop/m-p/165083#M31894</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-04-02T20:34:19Z</dc:date>
    </item>
  </channel>
</rss>

