<?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 save all contents of files(home) to a file in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/how-to-save-all-contents-of-files-home-to-a-file/m-p/922273#M11235</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;This still does not run.  I am on a -2 server (u50158717-2). Could that be it. How would instructions change?  Mary&lt;BR /&gt;&lt;BR /&gt;filename in '/home/u50158717/FILE(HOME)';
filename out zip '/home/u50158717/FILE.HOME.zip';
data _null_;
length fname mname $256 ;
infile in('*') filename=fname ;
input;
mname = scan(fname,-1,'/\');
file out MEMVAR=mname;
put _infile_;
run; quit;

filename in '/home/u50158717/vt';
filename out zip '/home/u50158717/vt.zip';
data _null_;
length fname mname $256 ;
infile in('*') filename=fname ;
input;
mname = scan(fname,-1,'/\');
file out MEMVAR=mname;
put _infile_;
run; quit;

filename in '/home/u50158717/gpa';
filename out zip '/home/u50158717/gpa.zip';
data _null_;
length fname mname $256 ;
infile in('*') filename=fname ;
input;
mname = scan(fname,-1,'/\');
file out MEMVAR=mname;
put _infile_;
run; quit;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 29 Mar 2024 14:17:18 GMT</pubDate>
    <dc:creator>marymarion</dc:creator>
    <dc:date>2024-03-29T14:17:18Z</dc:date>
    <item>
      <title>how to save all contents of files(home) to a file</title>
      <link>https://communities.sas.com/t5/SAS-Studio/how-to-save-all-contents-of-files-home-to-a-file/m-p/919383#M11218</link>
      <description>&lt;PRE&gt;&lt;CODE class=""&gt;filename in '/home/u50158717/FILES(HOME)'; /* Specify the input directory */
filename out '/home/u50158717/FILES.HOME.zip'; /* Specify the output zip file */
data _null_;
    length fname mname $256;
    infile in('*') filename=fname truncover; /* Use the INFILE statement to read the contents of the input directory */
    input;
    mname = scan(fname,-1,'/\'); /* Extract the filename from the filepath */
    file out MEMVAR=mname; /* Use the FILE statement to specify the output file */
    put _infile_; /* Write the content of each file to the output file */
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Mar 2024 23:24:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/how-to-save-all-contents-of-files-home-to-a-file/m-p/919383#M11218</guid>
      <dc:creator>marymarion</dc:creator>
      <dc:date>2024-03-07T23:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to save all contents of files(home) to a file</title>
      <link>https://communities.sas.com/t5/SAS-Studio/how-to-save-all-contents-of-files-home-to-a-file/m-p/919385#M11219</link>
      <description>&lt;P&gt;See this helpful macro&lt;/P&gt;
&lt;DIV id="content2"&gt;
&lt;H2&gt;&lt;A href="https://support.sas.com/kb/45/256.html" target="_self"&gt;Sample&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;I&gt;45256:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/I&gt;How to zip all data sets in a directory using ODS&lt;/A&gt;&lt;/H2&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/463997"&gt;@marymarion&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;filename in '/home/u50158717/FILES(HOME)'; /* Specify the input directory */
filename out '/home/u50158717/FILES.HOME.zip'; /* Specify the output zip file */
data _null_;
    length fname mname $256;
    infile in('*') filename=fname truncover; /* Use the INFILE statement to read the contents of the input directory */
    input;
    mname = scan(fname,-1,'/\'); /* Extract the filename from the filepath */
    file out MEMVAR=mname; /* Use the FILE statement to specify the output file */
    put _infile_; /* Write the content of each file to the output file */
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 07 Mar 2024 23:39:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/how-to-save-all-contents-of-files-home-to-a-file/m-p/919385#M11219</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2024-03-07T23:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: how to save all contents of files(home) to a file</title>
      <link>https://communities.sas.com/t5/SAS-Studio/how-to-save-all-contents-of-files-home-to-a-file/m-p/922273#M11235</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;This still does not run.  I am on a -2 server (u50158717-2). Could that be it. How would instructions change?  Mary&lt;BR /&gt;&lt;BR /&gt;filename in '/home/u50158717/FILE(HOME)';
filename out zip '/home/u50158717/FILE.HOME.zip';
data _null_;
length fname mname $256 ;
infile in('*') filename=fname ;
input;
mname = scan(fname,-1,'/\');
file out MEMVAR=mname;
put _infile_;
run; quit;

filename in '/home/u50158717/vt';
filename out zip '/home/u50158717/vt.zip';
data _null_;
length fname mname $256 ;
infile in('*') filename=fname ;
input;
mname = scan(fname,-1,'/\');
file out MEMVAR=mname;
put _infile_;
run; quit;

filename in '/home/u50158717/gpa';
filename out zip '/home/u50158717/gpa.zip';
data _null_;
length fname mname $256 ;
infile in('*') filename=fname ;
input;
mname = scan(fname,-1,'/\');
file out MEMVAR=mname;
put _infile_;
run; quit;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Mar 2024 14:17:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/how-to-save-all-contents-of-files-home-to-a-file/m-p/922273#M11235</guid>
      <dc:creator>marymarion</dc:creator>
      <dc:date>2024-03-29T14:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to save all contents of files(home) to a file</title>
      <link>https://communities.sas.com/t5/SAS-Studio/how-to-save-all-contents-of-files-home-to-a-file/m-p/922275#M11236</link>
      <description>&lt;P&gt;Any time you have questions about the behavior or results of code provide the LOG from running the code.&lt;/P&gt;
&lt;P&gt;We can't just copy your code and run it because we haven't your data or other files that may be in the folder, permissions to your location.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the only way we have a chance of seeing what is happening is if you share the LOG.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Mar 2024 14:28:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/how-to-save-all-contents-of-files-home-to-a-file/m-p/922275#M11236</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-03-29T14:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: how to save all contents of files(home) to a file</title>
      <link>https://communities.sas.com/t5/SAS-Studio/how-to-save-all-contents-of-files-home-to-a-file/m-p/922276#M11237</link>
      <description>&lt;P&gt;Does the ZIP engine actually allow you to write multiple files in one step like that?&amp;nbsp; Did you test it independently first?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also do you really have a directory name that has parentheses in it like that?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Mar 2024 14:39:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/how-to-save-all-contents-of-files-home-to-a-file/m-p/922276#M11237</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-29T14:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to save all contents of files(home) to a file</title>
      <link>https://communities.sas.com/t5/SAS-Studio/how-to-save-all-contents-of-files-home-to-a-file/m-p/922278#M11238</link>
      <description>&lt;P&gt;Use &lt;A href="https://github.com/SASPAC/baseplus" target="_self"&gt;BasePlus package&lt;/A&gt;, it has the &lt;A href="https://github.com/SASPAC/baseplus/blob/main/baseplus.md#-ziparch-macro--" target="_self"&gt;%zipArch()&lt;/A&gt; macro which does the job, and also the &lt;A href="https://github.com/SASPAC/baseplus/blob/main/baseplus.md#-unziparch-macro--" target="_self"&gt;%unzipArch()&lt;/A&gt; which un-zips zip created by the first one (of course regular zipps like 7zip or unzip works too).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
options dlCreateDir;
libname arch1 "%workPath()/testArch1";
libname arch2 "%workPath()/testArch2";

filename arch1 "%workPath()/testArch1";

data _null_;
  file arch1(test1.txt);
  put "text for test file 1";
data _null_;
  file arch1(test2.txt);
  put "text for test file 2";
data _null_;
  file arch1(test3.txt);
  put "text for test file 3";
run;

data arch1.class(index=(name));
  set sashelp.class;
run;
data arch1.cars(index=(model));
  set sashelp.cars;
run;



%zipArch(
  archName1.zip
, path = %workPath()/testArch1
, list = 1 
, overwrite = 1

)

%zipArch(
  archName2.zip
, pathRef = arch1
, target = %workPath()/testArch2
, list = 1 
, overwrite = 1
)


%unzipArch(
  archName2.zip 
, path = %workPath()/testArch2
, target = %workPath()/testArch2
, clean=1
, list=1
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S. How to get BasePlus?&lt;/P&gt;
&lt;P&gt;To work with SAS Packages like&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://github.com/orgs/SASPAC/repositories" target="_self" rel="nofollow noreferrer noopener"&gt;BasePlus or others&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;you will need&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;A href="https://github.com/yabwon/SAS_PACKAGES" target="_self" rel="nofollow noreferrer noopener"&gt;SAS Packages Framework&lt;/A&gt;&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lets assume your SAS session has access to the internet (if not look below).&lt;/P&gt;
&lt;P&gt;1) Create a directory where you want to store SPF and packages, for example let it be:&amp;nbsp;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token string"&gt;"/home/myuserid/SASpackages"&lt;/SPAN&gt;&lt;/CODE&gt;&amp;nbsp;under Linux or&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token string"&gt;"C:\Users\myuserid\SASpackages"&lt;/SPAN&gt;&lt;/CODE&gt;&amp;nbsp;under Windows.&lt;/P&gt;
&lt;P&gt;2) Run the following code only one time to get the SPF:&lt;/P&gt;
&lt;PRE class="lia-code-sample  language-sas"&gt;&lt;CODE&gt;filename packages "/home/myuserid/SASpackages"; /* setup directory for packages */
filename SPFinit url "https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas";
%include SPFinit; /* enable the framework */

%installPackage(SPFinit) /* install SPF */
%installPackage(BasePlus) /* install BasePlus */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(installation of other packages goes the same way - by installPackage macro).&lt;/P&gt;
&lt;P&gt;3) From now on, in this and any new SAS session, to enable SPF and BasePlus just run:&lt;/P&gt;
&lt;PRE class="lia-code-sample  language-sas"&gt;&lt;CODE&gt;filename packages "/home/myuserid/SASpackages"; /* setup directory for packages */
%include packages(SPFinit.sas); /* enable the framework */

%loadPackage(BasePlus)    /* load the package content into the SAS session */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;4) Enjoy&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S.2&lt;/P&gt;
&lt;P&gt;No access to the internet on your machine? No problem! Instead step number 2 go&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF" target="_self" rel="nofollow noopener noreferrer"&gt;here&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and manually download&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;SPFinit.sas&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;file. Then go to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://github.com/SASPAC/baseplus" target="_self" rel="nofollow noopener noreferrer"&gt;here&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and download&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;baseplus.zip&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;file. Store them in the directory from step 1 and proceed to step 3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Mar 2024 15:30:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/how-to-save-all-contents-of-files-home-to-a-file/m-p/922278#M11238</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-03-29T15:30:22Z</dc:date>
    </item>
  </channel>
</rss>

