<?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 unzip a file via SAS (via SAS Studio / SSOD) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-unzip-a-file-via-SAS-via-SAS-Studio-SSOD/m-p/461791#M284826</link>
    <description>&lt;P&gt;If using a hosted SAS, you might not have the unzip command (OS shell) as an option.&amp;nbsp; But you can use &lt;A href="https://blogs.sas.com/content/sasdummy/2015/05/11/using-filename-zip-to-unzip-and-read-data-files-in-sas/" target="_self"&gt;the FILENAME ZIP method to list and read files&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Sat, 12 May 2018 19:29:42 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2018-05-12T19:29:42Z</dc:date>
    <item>
      <title>How to unzip a file via SAS (via SAS Studio / SSOD)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-unzip-a-file-via-SAS-via-SAS-Studio-SSOD/m-p/461780#M284824</link>
      <description>&lt;P&gt;I'm trying to decompress a file in the zip format using pure SAS code, that I can integrate as one of the steps of a SAS script. I'm running SAS via the web version of SAS Studio on the cloud hosted version (SSOD).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Reading the documentation, I was able to come up with this, which attempts to expand all files in the zip to the same directory:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data _null_;
&amp;nbsp; infile "unzip /project/input/file.zip" pipe ;
&amp;nbsp; input ;
&amp;nbsp; put _infile_;
run;

&lt;/PRE&gt;&lt;P&gt;But I couldn't find how to tell it a specific directory to write the files, and I couldn't find how I extract a specific file from the zip file.&lt;/P&gt;</description>
      <pubDate>Sat, 12 May 2018 17:43:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-unzip-a-file-via-SAS-via-SAS-Studio-SSOD/m-p/461780#M284824</guid>
      <dc:creator>the_yeti</dc:creator>
      <dc:date>2018-05-12T17:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to unzip a file via SAS (via SAS Studio / SSOD)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-unzip-a-file-via-SAS-via-SAS-Studio-SSOD/m-p/461787#M284825</link>
      <description>&lt;P&gt;You could first extract a list of files, and then extract all files one-by-one to stdout, all by using filename pipe.&lt;/P&gt;
&lt;P&gt;See the documentation of unzip:&amp;nbsp;&lt;A href="https://linux.die.net/man/1/unzip" target="_blank"&gt;https://linux.die.net/man/1/unzip&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 May 2018 19:04:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-unzip-a-file-via-SAS-via-SAS-Studio-SSOD/m-p/461787#M284825</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-12T19:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to unzip a file via SAS (via SAS Studio / SSOD)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-unzip-a-file-via-SAS-via-SAS-Studio-SSOD/m-p/461791#M284826</link>
      <description>&lt;P&gt;If using a hosted SAS, you might not have the unzip command (OS shell) as an option.&amp;nbsp; But you can use &lt;A href="https://blogs.sas.com/content/sasdummy/2015/05/11/using-filename-zip-to-unzip-and-read-data-files-in-sas/" target="_self"&gt;the FILENAME ZIP method to list and read files&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Sat, 12 May 2018 19:29:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-unzip-a-file-via-SAS-via-SAS-Studio-SSOD/m-p/461791#M284826</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2018-05-12T19:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to unzip a file via SAS (via SAS Studio / SSOD)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-unzip-a-file-via-SAS-via-SAS-Studio-SSOD/m-p/461794#M284827</link>
      <description>&lt;P&gt;That works! Thank you&lt;/P&gt;</description>
      <pubDate>Sat, 12 May 2018 19:50:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-unzip-a-file-via-SAS-via-SAS-Studio-SSOD/m-p/461794#M284827</guid>
      <dc:creator>the_yeti</dc:creator>
      <dc:date>2018-05-12T19:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to unzip a file via SAS (via SAS Studio / SSOD)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-unzip-a-file-via-SAS-via-SAS-Studio-SSOD/m-p/583782#M284828</link>
      <description>&lt;P&gt;&lt;STRONG&gt;That doesn't work.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Can you let me know exactly how to extract just a single file from a gz?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Here's my code. The directory is in a Unix server. This crashes even if I add GZIP at the end of the filename clause.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;23 GOPTIONS ACCESSIBLE;&lt;BR /&gt;24 filename inzip ZIP "/home/jrsousa2/my_content/discogs_20081014_releases.xml.gz";&lt;BR /&gt;25&lt;BR /&gt;26 /* identify a temp folder in the WORK directory */&lt;BR /&gt;27 %let Nome=discogs_20081014_releases.xml;&lt;BR /&gt;28 filename xml "%sysfunc(getoption(work))/&amp;amp;Nome" ;&lt;BR /&gt;29&lt;BR /&gt;30 %put ### %sysfunc(getoption(work));&lt;BR /&gt;### /saswork/SAS_workF376000058C4_odaws02-prod-us/SAS_work3611000058C4_odaws02-prod-us&lt;BR /&gt;31&lt;BR /&gt;32 /* hat tip: "data _null_" on SAS-L */&lt;BR /&gt;33 data _null_;&lt;BR /&gt;34 /* using member syntax here */&lt;BR /&gt;35 infile inzip(&amp;amp;Nome) lrecl=256 recfm=F length=length eof=eof unbuf;&lt;BR /&gt;36 file xml lrecl=256 recfm=N;&lt;BR /&gt;37 input;&lt;BR /&gt;38 put _infile_ $varying256. length;&lt;BR /&gt;39 return;&lt;BR /&gt;40 eof:&lt;BR /&gt;41 stop;&lt;BR /&gt;42 run;&lt;BR /&gt;&lt;STRONG&gt;ERROR: The file "/home/jrsousa2/my_content/discogs_20081014_releases.xml.gz" exists and is not a zip file. The output file must be &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;a zip file.&lt;/STRONG&gt;&lt;BR /&gt;43&lt;BR /&gt;44 GOPTIONS NOACCESSIBLE;&lt;BR /&gt;45 %LET _CLIENTTASKLABEL=;&lt;BR /&gt;46 %LET _CLIENTPROCESSFLOWNAME=;&lt;BR /&gt;47 %LET _CLIENTPROJECTPATH=;&lt;BR /&gt;48 %LET _CLIENTPROJECTNAME=;&lt;BR /&gt;49 %LET _SASPROGRAMFILE=;&lt;BR /&gt;50&lt;BR /&gt;51 ;*';*";*/;quit;run;&lt;BR /&gt;52 ODS _ALL_ CLOSE;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 26 Aug 2019 05:44:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-unzip-a-file-via-SAS-via-SAS-Studio-SSOD/m-p/583782#M284828</guid>
      <dc:creator>jrsousa2</dc:creator>
      <dc:date>2019-08-26T05:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to unzip a file via SAS (via SAS Studio / SSOD)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-unzip-a-file-via-SAS-via-SAS-Studio-SSOD/m-p/583814#M284829</link>
      <description>&lt;P&gt;What did you get when you used the gzip option?&lt;/P&gt;
&lt;P&gt;What version of SAS do you have? gzip was introduced with 9.4M5.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 05:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-unzip-a-file-via-SAS-via-SAS-Studio-SSOD/m-p/583814#M284829</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-08-26T05:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to unzip a file via SAS (via SAS Studio / SSOD)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-unzip-a-file-via-SAS-via-SAS-Studio-SSOD/m-p/583818#M284830</link>
      <description>&lt;P&gt;It seems that I was able to make the code work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It didn't issue me any error messages, I had to modify the code though.&lt;/P&gt;&lt;P&gt;I ran this on SAS for academics, EG 7.1 or so:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%let Arq=%sysfunc(getoption(work))/releases.xml;

filename fromzip ZIP "/home/jrsousa2/my_content/releases.xml.gz" GZIP;
filename target "&amp;amp;Arq" encoding='utf-8';
 
data _null_;   
   infile fromzip;
   file target ;
   input;
   put _infile_ ;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 05:43:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-unzip-a-file-via-SAS-via-SAS-Studio-SSOD/m-p/583818#M284830</guid>
      <dc:creator>jrsousa2</dc:creator>
      <dc:date>2019-08-26T05:43:44Z</dc:date>
    </item>
  </channel>
</rss>

