<?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 read a zip xport file without having to unzip it ? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-read-a-zip-xport-file-without-having-to-unzip-it/m-p/971713#M46074</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename oscmd pipe "unzip -l /dwh_actuariat/sasdata_controlled/current/be/othr/bel.prod0030.saf3fm.data/saf3fm_billing.zip 2&amp;gt;&amp;amp;1";

data _null_;
infile oscmd;
input;
put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What I am getting:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Archive:  /dwh_actuariat/sasdata_controlled/current/be/othr/bel.prod0030.saf3fm.data/saf3fm_billing.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
297385440  07-30-2025 06:06   SAF3FM.XPORT
---------                     -------
297385440                     1 file&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is there a way to put the file name into a macro function and execute the next unix command in work as we may have the file name ?&lt;/P&gt;</description>
    <pubDate>Wed, 30 Jul 2025 15:24:50 GMT</pubDate>
    <dc:creator>alepage</dc:creator>
    <dc:date>2025-07-30T15:24:50Z</dc:date>
    <item>
      <title>how to read a zip xport file without having to unzip it ?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-read-a-zip-xport-file-without-having-to-unzip-it/m-p/971710#M46072</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to first use a Unix command to the content of the zip file ?&lt;BR /&gt;Is there a way to read the xport file in work without having to unzip it ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide the SAS Code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's my script which works correctly but I need to unzip into the temp folder the use the libname xport&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let pathbebill=/dwh_actuariat/sasdata_controlled/current/be/othr/bel.prod0030.saf3fm.data;
%let fname=saf3fm_billing.zip;
%let work=%sysfunc(pathname(work));
%let path=/finsys/bicoe/users/rpnna322/Temp/;
%let outputfile=SAF3FM.XPORT;

filename oscmd pipe "unzip -d &amp;amp;path. -o &amp;amp;pathbebill./&amp;amp;fname. 2&amp;gt;&amp;amp;1";

data _null_;
infile oscmd;
input;
put _infile_;
run;

libname myxport xport "&amp;amp;path./&amp;amp;outputfile.";

proc copy inlib=myxport out=work;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;How to read the xport file witout having to unzip it ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 15:09:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-read-a-zip-xport-file-without-having-to-unzip-it/m-p/971710#M46072</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2025-07-30T15:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to read a zip xport file without having to unzip it ?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-read-a-zip-xport-file-without-having-to-unzip-it/m-p/971712#M46073</link>
      <description>&lt;P&gt;From the documentation, it seems that a physical filename must be used for the target file, so you cannot use a file reference created with the ZIP option there. This means you have to unzip first.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 15:19:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-read-a-zip-xport-file-without-having-to-unzip-it/m-p/971712#M46073</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-07-30T15:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to read a zip xport file without having to unzip it ?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-read-a-zip-xport-file-without-having-to-unzip-it/m-p/971713#M46074</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename oscmd pipe "unzip -l /dwh_actuariat/sasdata_controlled/current/be/othr/bel.prod0030.saf3fm.data/saf3fm_billing.zip 2&amp;gt;&amp;amp;1";

data _null_;
infile oscmd;
input;
put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What I am getting:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Archive:  /dwh_actuariat/sasdata_controlled/current/be/othr/bel.prod0030.saf3fm.data/saf3fm_billing.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
297385440  07-30-2025 06:06   SAF3FM.XPORT
---------                     -------
297385440                     1 file&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is there a way to put the file name into a macro function and execute the next unix command in work as we may have the file name ?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 15:24:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-read-a-zip-xport-file-without-having-to-unzip-it/m-p/971713#M46074</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2025-07-30T15:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to read a zip xport file without having to unzip it ?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-read-a-zip-xport-file-without-having-to-unzip-it/m-p/971718#M46077</link>
      <description>&lt;P&gt;You can parse the output of the unzip command for the "XPORT" word and then extract the filename:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if index(_infile_,"XPORT")
then call symputx("fname",scan(_infile_,-1));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Jul 2025 15:41:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-read-a-zip-xport-file-without-having-to-unzip-it/m-p/971718#M46077</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-07-30T15:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to read a zip xport file without having to unzip it ?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-read-a-zip-xport-file-without-having-to-unzip-it/m-p/971719#M46078</link>
      <description>&lt;P&gt;How about something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let outputfile=SAF3FM.XPORT;
%let work=%sysfunc(pathname(WORK));

/* create a ZIP file with some content */

/* create xport file */
libname myxport xport "&amp;amp;work./&amp;amp;outputfile.";
data myxport.iris;
  set sashelp.iris(rename=(Species=SPEC SepalLength=SL SepalWidth=SW PetalLength=PL PetalWidth=PW));
run;

/* copy xport file into zip */
/* in */
filename A "&amp;amp;work./&amp;amp;outputfile." lrecl=1 recfm=N;
/* out */
filename B ZIP "&amp;amp;work./myFile.zip" member="&amp;amp;outputfile." lrecl=1 recfm=N;

data _null_;
  rc=fcopy("A","B");
  put rc=;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And then:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* get data from the zip file */

%let path=%sysfunc(pathname(WORK));
%let outputfile=SAF3FM.XPORT;

filename C ZIP "&amp;amp;path./myFile.zip" member="&amp;amp;outputfile." lrecl=1 recfm=N;
filename D "&amp;amp;work./&amp;amp;outputfile." lrecl=1 recfm=N;

data _null_;
  rc=fcopy("C","D");
  put rc=;
run;

libname myxport xport "&amp;amp;path./&amp;amp;outputfile.";

proc copy inlib=myxport out=work;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 15:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-read-a-zip-xport-file-without-having-to-unzip-it/m-p/971719#M46078</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2025-07-30T15:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to read a zip xport file without having to unzip it ?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-read-a-zip-xport-file-without-having-to-unzip-it/m-p/971723#M46079</link>
      <description>&lt;P&gt;Not with the XPORT libref engine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you try using the %XPT2LOC() autocall macro that SAS provides instead?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename myxport zip
 "/dwh_actuariat/sasdata_controlled/current/be/othr/bel.prod0030.saf3fm.data/saf3fm_billing.zip"
  member="SAF3FM.XPORT"
;
%xpt2loc(filespec=myxport)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If that doesn't work then try using this macro instead&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/sasutils/macros/blob/master/xport2sas.sas" target="_blank" rel="noopener"&gt;https://github.com/sasutils/macros/blob/master/xport2sas.sas&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%xport2sas(myxport)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Jul 2025 19:28:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-read-a-zip-xport-file-without-having-to-unzip-it/m-p/971723#M46079</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-07-30T19:28:38Z</dc:date>
    </item>
  </channel>
</rss>

