<?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 retrieve headers from proc http in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/retrieve-headers-from-proc-http/m-p/704431#M215945</link>
    <description>&lt;P&gt;I am making an API GET call that returns a field I need in the headers. I am able to get the headers into a file using&amp;nbsp;headerout. How do I pull a specific header value into a variable? Here is what I part of the output from headerout.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Server: Microsoft-IIS/10.0
X-AspNetMvc-Version: 3.0
X-MWS-CV-Last-Updated: 2020-12-07T21:54:45
X-AspNet-Version: 4.0.30319&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I need to retrieve just X-MWS-CV-Last-Updated. Is there a way to do that short of text parsing the entire thing?&lt;/P&gt;</description>
    <pubDate>Tue, 08 Dec 2020 16:00:03 GMT</pubDate>
    <dc:creator>evaleah</dc:creator>
    <dc:date>2020-12-08T16:00:03Z</dc:date>
    <item>
      <title>retrieve headers from proc http</title>
      <link>https://communities.sas.com/t5/SAS-Programming/retrieve-headers-from-proc-http/m-p/704431#M215945</link>
      <description>&lt;P&gt;I am making an API GET call that returns a field I need in the headers. I am able to get the headers into a file using&amp;nbsp;headerout. How do I pull a specific header value into a variable? Here is what I part of the output from headerout.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Server: Microsoft-IIS/10.0
X-AspNetMvc-Version: 3.0
X-MWS-CV-Last-Updated: 2020-12-07T21:54:45
X-AspNet-Version: 4.0.30319&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I need to retrieve just X-MWS-CV-Last-Updated. Is there a way to do that short of text parsing the entire thing?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 16:00:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/retrieve-headers-from-proc-http/m-p/704431#M215945</guid>
      <dc:creator>evaleah</dc:creator>
      <dc:date>2020-12-08T16:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve headers from proc http</title>
      <link>https://communities.sas.com/t5/SAS-Programming/retrieve-headers-from-proc-http/m-p/704557#M215997</link>
      <description>&lt;P&gt;There is no built-in reader for parsing header files.&amp;nbsp; You can perform simple text processing as follows to get either name/value data set, or single row table after transposing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;filename header temp;

* simulate header returned from API GET call;
data _null_;
  file header; input; put _infile_; datalines;
Server: Microsoft-IIS/10.0
X-AspNetMvc-Version: 3.0
X-MWS-CV-Last-Updated: 2020-12-07T21:54:45
X-AspNet-Version: 4.0.30319
;

data header_items;
  length name value $200;

  infile header;
  input;

  _cpos = index(_infile_,':');

  name  = substr(_infile_,1,_cpos-1);
  value = substr(_infile_,_cpos+1);
run;

proc transpose data=header_items out=header_vars(drop=_name_);
  id name;
  var value;
run;&lt;/PRE&gt;
&lt;P&gt;Name Value pairs&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RichardADeVenezia_0-1607462493826.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/52442i2A80CF31A86AD299/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RichardADeVenezia_0-1607462493826.png" alt="RichardADeVenezia_0-1607462493826.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Header attribute name as column name (after transpose)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RichardADeVenezia_1-1607462583550.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/52443iD80CE1A67C23362E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RichardADeVenezia_1-1607462583550.png" alt="RichardADeVenezia_1-1607462583550.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 21:23:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/retrieve-headers-from-proc-http/m-p/704557#M215997</guid>
      <dc:creator>RichardDeVen</dc:creator>
      <dc:date>2020-12-08T21:23:15Z</dc:date>
    </item>
  </channel>
</rss>

