<?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: Call macro within Set statement, read in dataset on Linux SAS 9.4 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600844#M173741</link>
    <description>&lt;P&gt;To get that message you will need to run a SET statement without any dataset name.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So that means your current macro is not only no longer generating the X command. It is also NOT generating the name that the SET command could use to find the dataset you unzipped.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you not read the example macros that we posted for you?&lt;/P&gt;</description>
    <pubDate>Thu, 31 Oct 2019 21:12:30 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-10-31T21:12:30Z</dc:date>
    <item>
      <title>Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600543#M173620</link>
      <description>&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;Boss is requesting my macro that gunzips data sets in hundreds of folders&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;be replaced in the existing SAS code base of over 80 programs.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;This macro will be in the SAS_utils folder, so all 80 programs can call it.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;It is a very short (61 lines) macro that does the following:&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT size="3" color="#0000FF"&gt;Identify current temp SAS WORK directory&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="3" color="#0000FF"&gt;gunzip data set residing on server to temp SAS WORK Directory&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="3" color="#0000FF"&gt;Have calling SAS program read in dataset from temp SAS WORK directory.&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;Calling program's change is below:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;Instead of&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;"Data want;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;set &amp;amp;lib.&amp;amp;dataset;",&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;it has to be:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;"Data want;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;set %macro(&amp;amp;lib.&amp;amp;dataset);"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;OK fine.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;My macro is gunziping to the temporary SAS WORK directory on a Linux server (9.4).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;Temp SAS work directory is a&amp;nbsp;&lt;/FONT&gt;&lt;FONT size="3" color="#0000FF"&gt;very narly string - "/data/go/to/your/happy/place/tempsas/SAS_work0802000044B5_major_corp_server.com"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;Tempoary WORK directory is generated from the snippet below:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;&lt;FONT face="courier new,courier"&gt;put %sysfunc(getoption(work)); &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;%let tmpSASwrk = %sysfunc(getoption(work)); &lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;THIS IS A FIXED REQUIREMENT AND CANNOT BE CHANGED.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;Once the .gz dataset&amp;nbsp; is unpacked and read in from the temporary SAS WORK directory,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;when the SAS session ends, the dataset is deleted, so no&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;cleanup is necessary. (These files are very large)&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;Some of these SAS programs can run over 24 hours.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;Error occurs when Linux SAS runs&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;the statement below:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;x "gunzip -c /data/share/user/bigdatset.sas7dat.gz &amp;gt; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;/data/go/to/your/happy/place/tempsas/SAS_work0802000044B5_major_corp_server.com/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;bigdatset.sas7dat";&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="4" color="#0000FF"&gt;Errror:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;ERROR: File WORK.X.DATA does not exist.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;I'm assuming due to the SET statement, SAS is interpreting&amp;nbsp;"x gunzip -c yada yada" as a literal "x"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;referring to a dataset named "x".&amp;nbsp; (Then again, I could be wrong).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;This does not happen when I run the macro by itself&amp;nbsp; from within the calling SAS program&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;(without the SET statement) i.e."&lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;%macro(&amp;amp;lib.&amp;amp;dataset);" - &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;macro runs fine,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;the .gz file is unpacked in the tempsas directory,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;and is ready to be used in a data step.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;Problem is, that is not acceptable.&amp;nbsp; Macro has to be run within the existing code base so a global&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;replacement can be done on "SET&amp;nbsp;&amp;amp;lib.&amp;amp;dataset;"&amp;nbsp; &amp;nbsp;to&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;"SET %macro(&amp;amp;lib.&amp;amp;dataset);"&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;Bash script that calls SAS program will export some global variables &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;to the SAS program so the program knows&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;where the SAS_util folder can be found and will call&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;the macro from there.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;Is it it possible to run a macro within the SET statement that exits out of Linux SAS 9.4, &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;calls gunzip (then chmod, then change group permissions),&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;and returns back to the calling program &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;AND reads in the dataset that has been unpacked into the temp SAS directory?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;Thank&amp;nbsp; you.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 21:15:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600543#M173620</guid>
      <dc:creator>Jumboshrimps</dc:creator>
      <dc:date>2019-10-30T21:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600549#M173623</link>
      <description>&lt;P&gt;Show us the macro and the calling code ... all of it, not just selected snippets.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Error occurs when Linux SAS runs the statement below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;x "gunzip -c /data/share/user/bigdatset.sas7dat.gz &amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;/data/go/to/your/happy/place/tempsas/SAS_work0802000044B5_major_corp_server.com/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;bigdatset.sas7dat";&lt;/FONT&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this is what appears after the SET command when the macro resolves, then this can't possibly work because SAS thinks the command is SET X "gunzip ...", and it is trying to SET data set X, which it can't find. When the macro resolves, &lt;STRONG&gt;it must produce legal valid working SAS code&lt;/STRONG&gt;, and it appears that when this macro resolves in a SET statement, you get non-working code..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 22:27:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600549#M173623</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-10-30T22:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600578#M173636</link>
      <description>What kind of data sets are you reading here? SAS 9.4M5 added support for GZIP to the filename ZIP functions. Not sure how that works if it's SAS datasets though.</description>
      <pubDate>Wed, 30 Oct 2019 22:45:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600578#M173636</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-10-30T22:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600580#M173638</link>
      <description>Did you know that you can pass the full path to a SAS data set instead of using the libname or member name? You'll likely want to do that here I suspect. &lt;BR /&gt;&lt;BR /&gt;set 'c:\users\demo\class.sas7bdat'; &lt;BR /&gt;&lt;BR /&gt;This is valid code.</description>
      <pubDate>Wed, 30 Oct 2019 22:48:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600580#M173638</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-10-30T22:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600594#M173644</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/28840"&gt;@Jumboshrimps&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To use the macro call in a Set statement you need to write a function style macro. The main thing about such macros: You can only use macro language in it so that once the macro executes nothing is left over for the SAS compiler other than valid SAS syntax for a SET statement.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings12/004-2012.pdf" target="_self"&gt;Here a white paper&lt;/A&gt; with details. It even has an example for a macro call in a Set statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 00:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600594#M173644</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-10-31T00:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600623#M173660</link>
      <description>&lt;P&gt;Instead of using the&amp;nbsp;&lt;EM&gt;global Base SAS&lt;/EM&gt; statement X, use the macro statement %SYSEXEC.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 04:55:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600623#M173660</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-31T04:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600633#M173661</link>
      <description>&lt;P&gt;Is this close to what you need?&amp;nbsp; Obviously adjust for linux.&amp;nbsp; I don't see why you're using a %macro for the set statement instead of just macro variables?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint; 

* create test data ;
libname foo "\\my\UNC\path\Temp";

proc datasets lib=foo mt=(data catalog) kill nowarn nolist;
quit;

* check the results ;
title "FOO Before";
proc datasets lib=foo nowarn;
quit;

proc copy in=sashelp out=foo;
   select class cars shoes;
run;

* check the results ;
title "FOO After";
proc datasets lib=foo nowarn;
quit;

* zip them - I'm on Windows and we use 7-zip ;
%macro zip(path,data);
   %let exe=\\my\UNC\path\7-Zip\7z.exe;
   %let zip=&amp;amp;path\&amp;amp;data..7z;
   %let data=&amp;amp;path\&amp;amp;data..sas7bdat;
   data _null_;
      infile "&amp;amp;exe a ""&amp;amp;zip"" ""&amp;amp;data"" " pipe;
      input;
      put _infile_;
   run;
%mend;
%let path=%sysfunc(pathname(foo));
%zip(&amp;amp;path,class)
%zip(&amp;amp;path,cars)
%zip(&amp;amp;path,shoes)

* delete the datasets - 7-zip does not do so ;
proc datasets lib=foo mt=(data catalog) kill nowarn nolist;
quit;

* check the results ;
data _null_;
   infile "dir /b &amp;amp;path" pipe;
   input;
   put _infile_;
run;

**** OK, that was just to get some test data... *** ;

proc datasets lib=work mt=(data catalog) kill nowarn nolist;
quit;

* before ;
title "WORK Before";
proc datasets lib=work nowarn;
quit;

%macro unzip(path,data);
   %let exe=\\my\UNC\path\7-Zip\7z.exe;
   %let zip=&amp;amp;path\&amp;amp;data..7z;
   %let out=%sysfunc(pathname(work));
   data _null_;
      infile "&amp;amp;exe e ""&amp;amp;zip"" -o""&amp;amp;out"" -aoa &amp;amp;&amp;amp; del ""&amp;amp;zip"" " pipe;
      input;
      put _infile_;
   run;
%mend;
%unzip(&amp;amp;path,class)
%unzip(&amp;amp;path,cars)
%unzip(&amp;amp;path,shoes)

* after ;
title "WORK After";
proc datasets lib=work nowarn;
quit;

title;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Oct 2019 07:38:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600633#M173661</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-10-31T07:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600634#M173662</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;Is it it possible to run a macro &lt;FONT color="#FF0000"&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;within the SET statement&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;&lt;/FONT&gt; that exits out of Linux SAS 9.4,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;calls gunzip (then chmod, then change group permissions),&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;and returns back to the calling program&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;AND reads in the dataset that has been unpacked into the temp SAS directory?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#000000"&gt;No.&amp;nbsp; Well maybe dosubl()?&amp;nbsp; Anyway, even if that worked, I'd redesign the approach.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#000000"&gt;Unpack BEFORE the data step, THEN read the data.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#000000"&gt;Don't let the tail (an easy search and replace) wag the dog (crappy or impossible design).&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#000000"&gt;The fact that you have 80 programs that can be addressed by a simple search and replace on the set statement may indicate that they should have been modularized a while ago (for example macro-ized).&amp;nbsp; It stinks of copy and paste code that is now too hard to maintain.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#000000"&gt;Are your programs consistent enough that a multi-line search and replace, say via sed or awk, would work?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#000000"&gt;For example, replace:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
&amp;nbsp; &amp;nbsp;set &amp;amp;lib.&amp;amp;dataset;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#000000"&gt;with:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%unzip_macro(&amp;amp;path,&amp;amp;lib,&amp;amp;dataset);

data want;
&amp;nbsp; &amp;nbsp;set&amp;nbsp;@lib.&amp;amp;dataset;
...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or, are your programs SO similar that you could combine them into one, or at least much fewer than 80, via a well designed macro or set of macros?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 08:07:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600634#M173662</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-10-31T08:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600638#M173664</link>
      <description>&lt;P&gt;Hi Scott, it is possible:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* create data for testing */

libname test '$HOME/test';

data test.class;
set sashelp.class;
run;

filename oscmd pipe "gzip $HOME/test/class.sas7bdat";

data _null_;
infile oscmd;
input;
put _infile_;
run;

/* the macro with %sysexec */

%macro gzip_on_the_fly(filename,libname);
%local targetpath dsfilename;
%let targetpath=%sysfunc(pathname(&amp;amp;libname.));
%let dsfilename=%scan(%scan(&amp;amp;filename.,-1,/),1,.).sas7bdat;
%sysexec gzip -dc &amp;amp;filename. &amp;gt; &amp;amp;targetpath./&amp;amp;dsfilename.;
&amp;amp;libname..%scan(&amp;amp;dsfilename.,1,.)
%mend;

/* now use it */
data test.class1;
set
  %gzip_on_the_fly($HOME/test/class.sas7bdat.gz,work)
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The "problem" I see here is that the %sysexec is about as communicative as the X statement (read: not) and does not return any information about the success or non-success of the external command (apart from setting &amp;amp;SYSRC). The filename pipe I used for the compression is much better in that regard.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The macro assumes that any input file ends on&lt;/P&gt;
&lt;PRE&gt;.sas7bdat.gz&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;Edit: included libname in the code created by the macro.&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 12:39:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600638#M173664</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-31T12:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600664#M173674</link>
      <description>Lovely little macro function, Kurt.  Really nice example of the power of the macro language.</description>
      <pubDate>Thu, 31 Oct 2019 11:40:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600664#M173674</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2019-10-31T11:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600675#M173676</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Lovely little macro function, Kurt. Really nice example of the power of the macro language.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And there's nothing really fancy in it. No complicated lists and loops, no indirect addressing, no quoting/unquoting, just a few macro functions and the %sysexec.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And if you know that you'll always use WORK, it's like that:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro gzip_on_the_fly(filename);
%local targetpath dsfilename;
%let targetpath=%sysfunc(pathname(WORK));
%let dsfilename=%scan(%scan(&amp;amp;filename.,-1,/),1,.).sas7bdat;
%sysexec gzip -dc &amp;amp;filename. &amp;gt; &amp;amp;targetpath./&amp;amp;dsfilename.;
WORK.%scan(&amp;amp;dsfilename.,1,.)
%mend;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Oct 2019 12:38:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600675#M173676</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-31T12:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600677#M173677</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;Thank you for&amp;nbsp; your reply.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;Not in Linux it's not.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 13:10:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600677#M173677</guid>
      <dc:creator>Jumboshrimps</dc:creator>
      <dc:date>2019-10-31T13:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600678#M173678</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/28840"&gt;@Jumboshrimps&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;Thank you for&amp;nbsp; your reply.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3" color="#0000FF"&gt;Not in Linux it's not.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Don't be silly. Of course it's possible to use a physical name on a UNIX system:&lt;/P&gt;
&lt;PRE&gt;37         data '$HOME/test/class.sas7bdat';
38         set sashelp.class;
39         run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set $HOME/test/class.sas7bdat has 19 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Oct 2019 13:13:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600678#M173678</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-31T13:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600692#M173685</link>
      <description>&lt;P&gt;&lt;FONT color="#0000FF"&gt;Paige,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Thank you for your reply.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;I've attached entire macro - 61 lines (with some minor edits,such as changing ID's).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;This macro resolves as is, just not from the set statement.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Again, thanx,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;/*********************************************************************************************************&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;File name: c14_uzip_v3.sas&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Macro name : c14_uzip_v3&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Purpose: For a given .gz file incorporate the mechanism of unzipping the file of extension .gz&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;and storing in the SAS WORK directory.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Parameters:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;zpflname: the file name of the zipped file.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;zipflpth: path of the file in .gz file type&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;options mprint mlogic symbolgen;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;%macro c14_uzip_v3(zipflpth,zpflname,tmpSASwrk);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;%let zipflpth = %sysget (nmepath);%put nmepath &amp;gt;&amp;gt; &amp;amp;zipflpth; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;%let zpflname = %sysget(nmeds); %put nmeds &amp;gt;&amp;gt; &amp;amp;zpflname; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;%put &amp;amp;zipflpth; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;%put &amp;amp;zpflname;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;%put &amp;amp;zipflpth./&amp;amp;zpflname;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;%put %sysfunc(getoption(work)); &lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;%let tmpSASwrk = %sysfunc(getoption(work)); &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;%put &amp;amp;tmpSASwrk;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;%let filref=&amp;amp;zipflpth.;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;%if %sysfunc(fileexist("&amp;amp;filref./&amp;amp;zpflname..sas7bdat.gz")) %then %do;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;x "gunzip -c &amp;amp;zipflpth./&amp;amp;zpflname..sas7bdat.gz &amp;gt; &amp;amp;tmpSASwrk./&amp;amp;zpflname";&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;x "chmod 770 &amp;amp;tmpSASwrk./&amp;amp;zpflname..sas7bdat";&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;%end;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;%mend c14_uzip_v3;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 13:59:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600692#M173685</guid>
      <dc:creator>Jumboshrimps</dc:creator>
      <dc:date>2019-10-31T13:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600702#M173687</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/28840"&gt;@Jumboshrimps&lt;/a&gt;&amp;nbsp;You need to re-read what Paige wrote.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The macro processor evaluates the macro calls and macro variable references and passes the resulting text on the real SAS compiler to execute, just as if that text was what was in the source code to begin with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first two characters that your macro generates are X and space.&amp;nbsp; So when you call it in the MIDDLE of a SET statement the X looks to SAS like the name of the dataset you want to read.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you call the macro at a statement boundary it generates two statements. Something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x "gunzip -c /x/y/abc.sas7bdat.gz &amp;gt; /z/w//abc.sas7bdat";
x "chmod 770 /z/w//abc.sas7bdat"";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you call it in the middle of a SET statement your statements will look like this instead:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set x "gunzip -c /x/y/abc.sas7bdat.gz &amp;gt; /z/w//abc.sas7bdat";
x "chmod 770 /z/w//abc.sas7bdat"";
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So instead of two X statements you have a SET, and X and a null statement (bare semi-colon).&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 14:16:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600702#M173687</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-31T14:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600712#M173691</link>
      <description>&lt;P&gt;&lt;FONT color="#0000FF"&gt;Scott,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Thank you for your time on this:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Everything you stated is true, true, true, and more true.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;I presented your solution (call the macro, then the SET statement)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;in my original User Story and got shot down.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;I cannot re-design the approach.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Has to be "SET %macro(&amp;amp;lib.&amp;amp;dataset);"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;No other changes are permitted.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;I cannot unpack&amp;nbsp; the data to the SAS work directory&lt;EM&gt; before&lt;/EM&gt; reading in the data.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Solution for this User Story has to be "in-stream" (what ever that means).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Thank you again.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 14:43:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600712#M173691</guid>
      <dc:creator>Jumboshrimps</dc:creator>
      <dc:date>2019-10-31T14:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600721#M173697</link>
      <description>&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;Thank you for your response.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;Everyone seems very pleased with this solution.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;The current macro code includes:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2" color="#000000"&gt;%if %sysfunc(fileexist("&amp;amp;filref./&amp;amp;zpflname..sas7bdat.gz")) %then %do;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;x "gunzip -c &amp;amp;zipflpth./&amp;amp;zpflname..sas7bdat.gz &amp;gt; &amp;amp;tmpSASwrk./&amp;amp;zpflname";&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;x "chmod 770 &amp;amp;tmpSASwrk./&amp;amp;zpflname..sas7bdat";&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;(testing if the data set is in .gz format, if not, then set&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;the dataset as is from the directory it was found in).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;Files come&amp;nbsp;&lt;/FONT&gt;&lt;FONT size="3" color="#0000FF"&gt;to us from other vendors, some in native sas7bdat format, some&amp;nbsp;&lt;/FONT&gt;&lt;FONT size="3" color="#0000FF"&gt;.gz)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;Does your macro line&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="3" color="#000000"&gt;%let dsfilename=%scan(%scan(&amp;amp;filename.,-1,/),1,.).sas7bdat;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;make the first line unnecessary or redundant?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;Thank you again.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 15:23:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600721#M173697</guid>
      <dc:creator>Jumboshrimps</dc:creator>
      <dc:date>2019-10-31T15:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600725#M173698</link>
      <description>&lt;P&gt;What is the purpose of the %IF statement in your current attempt at a macro?&lt;/P&gt;
&lt;P&gt;Are you trying to only ungzip the file when the file is gzipped?&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you want to do if the dataset exists in normal format instead of gzipped format?&lt;/P&gt;
&lt;P&gt;What do you want to do if both the dataset and the gzipped file exist already?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or are you trying to check if the file exists at all.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you want to do when neither version of the file exists?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 15:41:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600725#M173698</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-31T15:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600732#M173700</link>
      <description>&lt;P&gt;So let's spell out the requirements for this macro.&lt;/P&gt;
&lt;P&gt;Input is a dataset specification.&amp;nbsp; So a either a two level name or a one level name.&amp;nbsp; For simplicity let's also assume that there is no USER libref defined nor any use of the USER system option so we can assume one level names reference WORK datasets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can we modify the files in the source library?&amp;nbsp; So if they specify X.Y and X point to folder /a/b/c can we modify the files in that folder?&amp;nbsp; Looks like you do NOT want to do that.&amp;nbsp; Instead you appear to be copying the unzipped file to the WORK folder.&amp;nbsp; Do you always want to use WORK? Or would it be better to have some other location where these unzipped files are written?&amp;nbsp; Perhaps we can make the macro flexible and pass in the target location as an optional parameter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So let's take the solution from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;and flesh it out a little.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro gunzip(dsname,target=work);
%local libref memname targetname filename return;

%* Split DSNAME into LIBREF and MEMNAME ;
%let memname=%scan(&amp;amp;dsname,-1,.);
%let libref=%scan(work.&amp;amp;dsname,-2,.);

%* Generate name of possible GZIP file based on LIBREF and MEMNAME ;
%let filename=%sysfunc(pathname(&amp;amp;libref))/%sysfunc(lowcase(&amp;amp;memname)).sas7bdat.gz;

%if %sysfunc(exist(&amp;amp;dsname)) %then %let return=&amp;amp;dsname ;
%else %if %sysfunc(fileexist(&amp;amp;filename)) %then %do;
  %let targetname=%sysfunc(pathname(&amp;amp;target))/%sysfunc(lowcase(&amp;amp;memname).sas7bdat;
  %sysexec gzip -dc "&amp;amp;filename" &amp;gt; "&amp;amp;targetname" ;
  %let return=&amp;amp;target..&amp;amp;memname;
%end;
%else %put ERROR: Could not find &amp;amp;=dsname or &amp;amp;=filename ;
&amp;amp;return.
%mend;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Oct 2019 16:01:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600732#M173700</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-31T16:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: Call macro within Set statement, read in dataset on Linux SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600736#M173701</link>
      <description>&lt;P&gt;&lt;FONT color="#0000FF"&gt;Upon invocation of the macro, I'm getting:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Beginning compilation of C14_UZIP_V3 using the autocall file /data/dev/utilities/sas_util/c14_uzip_v3.sas.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;ERROR: Macro keyword SYSEXEC appears as text.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;ERROR: A dummy macro will be compiled.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 16:28:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-macro-within-Set-statement-read-in-dataset-on-Linux-SAS-9-4/m-p/600736#M173701</guid>
      <dc:creator>Jumboshrimps</dc:creator>
      <dc:date>2019-10-31T16:28:15Z</dc:date>
    </item>
  </channel>
</rss>

