<?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: automating downloading and unzipping a file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/automating-downloading-and-unzipping-a-file/m-p/942676#M369636</link>
    <description>&lt;P&gt;I do not think SAS can unzip files directly. But you can run a x command to make the terminal unzip files and move them to another folder.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Sep 2024 10:21:08 GMT</pubDate>
    <dc:creator>rudfaden</dc:creator>
    <dc:date>2024-09-05T10:21:08Z</dc:date>
    <item>
      <title>automating downloading and unzipping a file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/automating-downloading-and-unzipping-a-file/m-p/942630#M369625</link>
      <description>&lt;P&gt;I'd like to automate the downloading and unzipping of a zipped file from the web.&amp;nbsp; I read Chris Hemedinger's blog post and can successfully download the file.&amp;nbsp; However, it resides in the SAS Temporary folder.&amp;nbsp; I need to unzip all files to a specific directory, such as W:\Data\2024-07.&amp;nbsp; Does SAS have a function to extract everything in a zipped file?&amp;nbsp; Note that I am not trying to use any of the extracted files, simply extracting all files to a library folder.&amp;nbsp; Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* detect proper delim for UNIX vs. Windows */
%let delim=%sysfunc(ifc(%eval(&amp;amp;sysscp. = WIN),\,/));

/* create a name for our downloaded ZIP */
%let ziploc =
	%sysfunc(getoption(work))&amp;amp;delim.datafile.zip;
filename download "&amp;amp;ziploc";

/* Download the ZIP file from the Internet*/
proc http
	method='GET'
	url="https://www.census.gov/trade/downloads/2024/Textile_summary_m/TEXSUMM2401.ZIP"
	out=download;
run;

/* Assign a fileref wth the ZIP method */
filename inzip zip "&amp;amp;ziploc";

/* Read the "members" (files) from the ZIP file */
data contents(keep=memname);
	length memname $200;
	fid=dopen("inzip");

	if fid=0 then
		stop;
	memcount=dnum(fid);

	do i=1 to memcount;
		memname=dread(fid,i);
		output;
	end;

	rc=dclose(fid);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2024 03:03:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/automating-downloading-and-unzipping-a-file/m-p/942630#M369625</guid>
      <dc:creator>texasmfp</dc:creator>
      <dc:date>2024-09-05T03:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: automating downloading and unzipping a file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/automating-downloading-and-unzipping-a-file/m-p/942676#M369636</link>
      <description>&lt;P&gt;I do not think SAS can unzip files directly. But you can run a x command to make the terminal unzip files and move them to another folder.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2024 10:21:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/automating-downloading-and-unzipping-a-file/m-p/942676#M369636</guid>
      <dc:creator>rudfaden</dc:creator>
      <dc:date>2024-09-05T10:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: automating downloading and unzipping a file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/automating-downloading-and-unzipping-a-file/m-p/942697#M369641</link>
      <description>&lt;P&gt;All you did so far was find the list of files inside the ZIP file.&amp;nbsp; Now use that list to generate the code to copy out the files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are a lot of examples out there:&amp;nbsp;&amp;nbsp;&lt;A href="https://www.google.com/search?q=%40sas.com+unzip+macro" target="_blank"&gt;https://www.google.com/search?q=%40sas.com+unzip+macro&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2024 13:27:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/automating-downloading-and-unzipping-a-file/m-p/942697#M369641</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-09-05T13:27:31Z</dc:date>
    </item>
  </channel>
</rss>

