<?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: How to Capture Part of Log as Macro Variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-Capture-Part-of-Log-as-Macro-Variable/m-p/959451#M374342</link>
    <description>&lt;P&gt;SAS will create and populate two automatic macro variables.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/v_058/proc/p0mwmz1upde0tqn1ptt5rnlly0tc.htm" target="_self"&gt;PROC HTTP Response Status Reporting&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Feb 2025 08:06:13 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2025-02-18T08:06:13Z</dc:date>
    <item>
      <title>How to Capture Part of Log as Macro Variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Capture-Part-of-Log-as-Macro-Variable/m-p/959419#M374324</link>
      <description>&lt;P&gt;Suppose I download a webpage via PROC HTTP.&lt;/P&gt;&lt;PRE&gt;filename myfile 'myfile.htm';

proc http url='https://www.macrotrends.net/stocks/charts/KO/cocacola/balance-sheet' out=myfile;
run;&lt;/PRE&gt;&lt;P&gt;Successful downloading returns NOTE: 200 OK as follows:&lt;/P&gt;&lt;PRE&gt;1   filename myfile 'myfile.htm';&lt;BR /&gt;2&lt;BR /&gt;3   proc http url='https://www.macrotrends.net/stocks/charts/KO/cocacola/balance-sheet' out=myfile;
4   run;

NOTE: 200 OK
NOTE: PROCEDURE HTTP used (Total process time):
      real time           0.05 seconds
      cpu time            0.00 seconds&lt;/PRE&gt;&lt;P&gt;Instead, unsuccessful downloading returns NOTE: 429 O as follows:&lt;/P&gt;&lt;PRE&gt;1   filename myfile 'myfile.htm';
2
3   proc http url='https://www.macrotrends.net/stocks/charts/KO/cocacola/balance-sheet' out=myfile;
4   run;

NOTE: 429 O
NOTE: PROCEDURE HTTP used (Total process time):
      real time           0.05 seconds
      cpu time            0.00 seconds&lt;/PRE&gt;&lt;P&gt;Is there any easy way to extract the "200" or "429" as a macro variable? Though I can output the log and infile it with symputx as follows, I wonder if there are easier ways than this.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;filename myfile 'myfile.htm';

proc printto log='mylog.log';
run;

proc http url='https://www.macrotrends.net/stocks/charts/KO/cocacola/balance-sheet' out=myfile;
run;

proc printto;
run;

data _null_;
	infile 'mylog.log' truncover;
	input;
	if scan(lag3(_infile_),3)='http' then call symputx('note',scan(_infile_,2));
run;

%put &amp;amp;note;

data _null_;
	infile 'del mylog.log' pipe;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks for any helpful suggestions.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2025 01:00:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Capture-Part-of-Log-as-Macro-Variable/m-p/959419#M374324</guid>
      <dc:creator>Junyong</dc:creator>
      <dc:date>2025-02-18T01:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to Capture Part of Log as Macro Variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Capture-Part-of-Log-as-Macro-Variable/m-p/959451#M374342</link>
      <description>&lt;P&gt;SAS will create and populate two automatic macro variables.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/v_058/proc/p0mwmz1upde0tqn1ptt5rnlly0tc.htm" target="_self"&gt;PROC HTTP Response Status Reporting&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2025 08:06:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Capture-Part-of-Log-as-Macro-Variable/m-p/959451#M374342</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2025-02-18T08:06:13Z</dc:date>
    </item>
  </channel>
</rss>

