<?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 Need Help:  HTTP PROC to display HTTP/1.1 code and message using 9.4 M3 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-Help-HTTP-PROC-to-display-HTTP-1-1-code-and-message-using-9/m-p/690641#M210104</link>
    <description>&lt;P&gt;I am having to difficulty to display code and message in the log.&amp;nbsp; I plan to use that code and tell SAS program to return code = 2 when the code &amp;lt;&amp;gt; 200&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I fix?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; proc http
      url=%UNQUOTE(%STR(%'&amp;amp;valueURL%'))
      method="POST"
       in=jason_in
      out=myout
      headerout=out;
      headers "host"=%UNQUOTE(%STR(%'&amp;amp;valueHost%')) "content-type"=%UNQUOTE(%STR(%'&amp;amp;valueType%')) "Authorization"="Basic %UNQUOTE(%STR(&amp;amp;basevalue))";
   run;

   data _null_;
       infile out;
      input;
      put _infile_;
   run;
   data _null_; 
           infile out scanover truncover; 
           input @'HTTP/1.1' code 4. message $255.; 
           call symputx('status_code',code,'g'); 
           call symputx('status_message',trim(message),'g'); 
        %put status_code=;
           %put status_message=;
   run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; MACROGEN(CALL_REST_SVC):   data _null_;
MACROGEN(CALL_REST_SVC):   infile out;
MACROGEN(CALL_REST_SVC):   input;
MACROGEN(CALL_REST_SVC):   put _infile_;
MACROGEN(CALL_REST_SVC):   run;
HTTP/1.1 403
Set-Cookie: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx; Path=/; Secure; HttpOnly
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
X-Frame-Options: DENY
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sat, 10 Oct 2020 04:58:13 GMT
Set-Cookie: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxc; path=/; HttpOnly; Secure
MACROGEN(CALL_REST_SVC):   data _null_;
MACROGEN(CALL_REST_SVC):   infile out scanover truncover;
MACROGEN(CALL_REST_SVC):   input @'HTTP/1.1 ' code 4. message $255.;
MACROGEN(CALL_REST_SVC):   call symputx('status_code',code,'g');
MACROGEN(CALL_REST_SVC):   call symputx('status_message',trim(message),'g');
status_code=
status_message=&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 10 Oct 2020 06:12:44 GMT</pubDate>
    <dc:creator>niejung</dc:creator>
    <dc:date>2020-10-10T06:12:44Z</dc:date>
    <item>
      <title>Need Help:  HTTP PROC to display HTTP/1.1 code and message using 9.4 M3</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Help-HTTP-PROC-to-display-HTTP-1-1-code-and-message-using-9/m-p/690641#M210104</link>
      <description>&lt;P&gt;I am having to difficulty to display code and message in the log.&amp;nbsp; I plan to use that code and tell SAS program to return code = 2 when the code &amp;lt;&amp;gt; 200&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I fix?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; proc http
      url=%UNQUOTE(%STR(%'&amp;amp;valueURL%'))
      method="POST"
       in=jason_in
      out=myout
      headerout=out;
      headers "host"=%UNQUOTE(%STR(%'&amp;amp;valueHost%')) "content-type"=%UNQUOTE(%STR(%'&amp;amp;valueType%')) "Authorization"="Basic %UNQUOTE(%STR(&amp;amp;basevalue))";
   run;

   data _null_;
       infile out;
      input;
      put _infile_;
   run;
   data _null_; 
           infile out scanover truncover; 
           input @'HTTP/1.1' code 4. message $255.; 
           call symputx('status_code',code,'g'); 
           call symputx('status_message',trim(message),'g'); 
        %put status_code=;
           %put status_message=;
   run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; MACROGEN(CALL_REST_SVC):   data _null_;
MACROGEN(CALL_REST_SVC):   infile out;
MACROGEN(CALL_REST_SVC):   input;
MACROGEN(CALL_REST_SVC):   put _infile_;
MACROGEN(CALL_REST_SVC):   run;
HTTP/1.1 403
Set-Cookie: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx; Path=/; Secure; HttpOnly
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
X-Frame-Options: DENY
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sat, 10 Oct 2020 04:58:13 GMT
Set-Cookie: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxc; path=/; HttpOnly; Secure
MACROGEN(CALL_REST_SVC):   data _null_;
MACROGEN(CALL_REST_SVC):   infile out scanover truncover;
MACROGEN(CALL_REST_SVC):   input @'HTTP/1.1 ' code 4. message $255.;
MACROGEN(CALL_REST_SVC):   call symputx('status_code',code,'g');
MACROGEN(CALL_REST_SVC):   call symputx('status_message',trim(message),'g');
status_code=
status_message=&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Oct 2020 06:12:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Help-HTTP-PROC-to-display-HTTP-1-1-code-and-message-using-9/m-p/690641#M210104</guid>
      <dc:creator>niejung</dc:creator>
      <dc:date>2020-10-10T06:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help:  HTTP PROC to display HTTP/1.1 code and message using 9.4 M3</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Help-HTTP-PROC-to-display-HTTP-1-1-code-and-message-using-9/m-p/690682#M210129</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
filename resp TEMP;
filename headers TEMP;

proc http method="GET" url="http://www.google.com" 
		headerout=headers out=resp 
		HEADEROUT_OVERWRITE;
run;

   data _null_;
       infile headers;
      input;
      put _infile_;
   run;
   
    
   data _null_; 
           infile headers scanover truncover; 
           input @'HTTP/1.1' code 4. message $255.; 
           call symputx('status_code',code,'g'); 
           call symputx('status_message',trim(message),'g'); 
        %put status_code=&amp;amp;status_code;
           %put status_message=&amp;amp;status_message;
           run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;       data _null_;
 90                    infile headers scanover truncover;
 91                    input @'HTTP/1.1' code 4. message $255.;
 92                    call symputx('status_code',code,'g');
 93                    call symputx('status_message',trim(message),'g');
 94                 %put status_code=&amp;amp;status_code;
 status_code=200
 95                    %put status_message=&amp;amp;status_message;
 status_message=OK
 96                    run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Oct 2020 15:23:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Help-HTTP-PROC-to-display-HTTP-1-1-code-and-message-using-9/m-p/690682#M210129</guid>
      <dc:creator>AnandVyas</dc:creator>
      <dc:date>2020-10-10T15:23:00Z</dc:date>
    </item>
  </channel>
</rss>

