<?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 Stream a binary file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Stream-a-binary-file/m-p/848046#M335288</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like a stored process to stream a binary file (zip archive containing text files) to _webout.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename arch ZIP "&amp;amp;path_to_file./myArchive.zip";

data _NULL_;
    set sashelp.class;
    file arch(class.txt);
    put _ALL_;
run;

data _null_;    
    rc=appsrv_header('Content-type:','application/zip');
    rc=appsrv_header('Content-disposition',"attachment; filename=myArchive.zip");
run;

/* Insert missing code here */
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;proc stream doesn't handle binary streams and a data step with put _INFILE_ won't work either.&lt;/P&gt;
&lt;P&gt;Both result in an insufficient authorization error message.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to stream binary files in SAS ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Dec 2022 09:21:32 GMT</pubDate>
    <dc:creator>gamotte</dc:creator>
    <dc:date>2022-12-06T09:21:32Z</dc:date>
    <item>
      <title>Stream a binary file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Stream-a-binary-file/m-p/848046#M335288</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like a stored process to stream a binary file (zip archive containing text files) to _webout.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename arch ZIP "&amp;amp;path_to_file./myArchive.zip";

data _NULL_;
    set sashelp.class;
    file arch(class.txt);
    put _ALL_;
run;

data _null_;    
    rc=appsrv_header('Content-type:','application/zip');
    rc=appsrv_header('Content-disposition',"attachment; filename=myArchive.zip");
run;

/* Insert missing code here */
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;proc stream doesn't handle binary streams and a data step with put _INFILE_ won't work either.&lt;/P&gt;
&lt;P&gt;Both result in an insufficient authorization error message.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to stream binary files in SAS ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 09:21:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Stream-a-binary-file/m-p/848046#M335288</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2022-12-06T09:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Stream a binary file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Stream-a-binary-file/m-p/848056#M335291</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I could solve my problem with a data step. My mistake was to use the arch fileref to access the file in the data step.&lt;/P&gt;
&lt;P&gt;With a new filename statement and using the new fileref in the datastep, i can now download my zip file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for reading.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 10:30:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Stream-a-binary-file/m-p/848056#M335291</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2022-12-06T10:30:43Z</dc:date>
    </item>
  </channel>
</rss>

