<?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: API Macro Loop issues in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/API-Macro-Loop-issues/m-p/971035#M377243</link>
    <description>&lt;P&gt;As i suspected, i was hitting the API to quickly. Apparently, some have a rate limit that my macro was exceeding.&amp;nbsp; I resolved my issue by slowing down my macro with the following code:&lt;/P&gt;
&lt;P&gt;Data _null_;&lt;/P&gt;
&lt;P&gt;call sleep(15,1);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Jul 2025 18:00:29 GMT</pubDate>
    <dc:creator>Lost_Gary</dc:creator>
    <dc:date>2025-07-17T18:00:29Z</dc:date>
    <item>
      <title>API Macro Loop issues</title>
      <link>https://communities.sas.com/t5/SAS-Programming/API-Macro-Loop-issues/m-p/971005#M377231</link>
      <description>&lt;P&gt;I have an API that works just fine. However, when i attempt to call the API several times within a Macro, after about the 4th call of the API, I get a data error that the dataset is not found.&amp;nbsp; I've put it in a do loop and then more simply put it in code such as this:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%macro one(macvar);&lt;/P&gt;
&lt;P&gt;filename rsi "\\mypath.json";&lt;BR /&gt;proc http &lt;BR /&gt;url="&lt;A href="https://my" target="_blank"&gt;https://my&lt;/A&gt; API &amp;amp;macvar" &lt;BR /&gt;out=rsi;&lt;BR /&gt;run;&lt;BR /&gt;libname rsi json "\\mypath.json";&lt;/P&gt;
&lt;P&gt;%mend;&lt;BR /&gt;%one(A);&lt;BR /&gt;%one(B);&lt;BR /&gt;%one(C);&lt;BR /&gt;%one(D);&lt;/P&gt;
&lt;P&gt;when it gets to D, i receive an error that the data set 'Results_Values' does not exist.&amp;nbsp; wondering if i am hitting the API to many times to fast with the macro. If I run D on it's own it will work just fine. Has anyone else experienced this and is there a known workaround? I am using SAS Enterprise Guide 8.3.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jul 2025 14:46:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/API-Macro-Loop-issues/m-p/971005#M377231</guid>
      <dc:creator>Lost_Gary</dc:creator>
      <dc:date>2025-07-17T14:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: API Macro Loop issues</title>
      <link>https://communities.sas.com/t5/SAS-Programming/API-Macro-Loop-issues/m-p/971006#M377232</link>
      <description>&lt;P&gt;Since you are having an error in code involving macros, please turn on the macro debugging option by running this command:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then run your code again, and show us the log. (&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;ALWAYS&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;show us the log if you are getting errors) In particular, we need the log for the run of %ONE that has the errors, and we need to see the entire log for that run of %ONE (not just the errors).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please use the &amp;lt;/&amp;gt; icon to include your log in your reply.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PaigeMiller_0-1715196634946.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96351i414DE7EE2D1B5DE6/image-size/large?v=v2&amp;amp;px=999" role="button" title="PaigeMiller_0-1715196634946.png" alt="PaigeMiller_0-1715196634946.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jul 2025 15:09:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/API-Macro-Loop-issues/m-p/971006#M377232</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-07-17T15:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: API Macro Loop issues</title>
      <link>https://communities.sas.com/t5/SAS-Programming/API-Macro-Loop-issues/m-p/971035#M377243</link>
      <description>&lt;P&gt;As i suspected, i was hitting the API to quickly. Apparently, some have a rate limit that my macro was exceeding.&amp;nbsp; I resolved my issue by slowing down my macro with the following code:&lt;/P&gt;
&lt;P&gt;Data _null_;&lt;/P&gt;
&lt;P&gt;call sleep(15,1);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jul 2025 18:00:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/API-Macro-Loop-issues/m-p/971035#M377243</guid>
      <dc:creator>Lost_Gary</dc:creator>
      <dc:date>2025-07-17T18:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: API Macro Loop issues</title>
      <link>https://communities.sas.com/t5/SAS-Programming/API-Macro-Loop-issues/m-p/971075#M377255</link>
      <description>&lt;P&gt;Use the headerout= option to save the servers response headers, and then you can log the information for examination and understanding on what to check for in terms of error handling.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename hdrout temp ;
proc http ... headerout=hdrout ...
run ;
data _null_ ;
  infile hdrout ; input ; put _infile_ ;
run ;
filename hdrout ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Jul 2025 03:58:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/API-Macro-Loop-issues/m-p/971075#M377255</guid>
      <dc:creator>RichardAD</dc:creator>
      <dc:date>2025-07-18T03:58:09Z</dc:date>
    </item>
  </channel>
</rss>

