<?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: Writing text Files to a ZIP archive using SAS ODS Package or FILENAME ZIP in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Writing-text-Files-to-a-ZIP-archive-using-SAS-ODS-Package-or/m-p/326525#M72728</link>
    <description>&lt;P&gt;Do you have x command enabled?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Honeslty this is easier to accomplish via line commands.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 21 Jan 2017 22:12:52 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-01-21T22:12:52Z</dc:date>
    <item>
      <title>Writing text Files to a ZIP archive using SAS ODS Package or FILENAME ZIP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-text-Files-to-a-ZIP-archive-using-SAS-ODS-Package-or/m-p/326524#M72727</link>
      <description>&lt;P&gt;I am trying to automate a process that involves receiving several text files with dates in the filename (AAYYYYMMDD.TXT format).&amp;nbsp; I am attempting to iteratively:&lt;/P&gt;
&lt;P&gt;1. Read the file into SAS for processing&lt;/P&gt;
&lt;P&gt;2. Archive the file in a ZIPX archive&lt;/P&gt;
&lt;P&gt;3. Delete or move the file from the working directory so that it is not processed again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The filename zip method is only documented to read the text file into a data step and write sas datasets to a zip archive.&amp;nbsp; I can not find any documentation on writing text files to a zip archive.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also attempted to use the ODS package method, but it seems to overwrite existing files in the archive when I access the package.&amp;nbsp; I need to be able to append new text files as they are processed and retain any exisitng files in the ZIP archive.&amp;nbsp; I will keep testing veriations on these methods, but any assistance would be appreciated.&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jan 2017 22:08:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-text-Files-to-a-ZIP-archive-using-SAS-ODS-Package-or/m-p/326524#M72727</guid>
      <dc:creator>Jim_Cooper_hmsa</dc:creator>
      <dc:date>2017-01-21T22:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: Writing text Files to a ZIP archive using SAS ODS Package or FILENAME ZIP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-text-Files-to-a-ZIP-archive-using-SAS-ODS-Package-or/m-p/326525#M72728</link>
      <description>&lt;P&gt;Do you have x command enabled?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Honeslty this is easier to accomplish via line commands.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jan 2017 22:12:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-text-Files-to-a-ZIP-archive-using-SAS-ODS-Package-or/m-p/326525#M72728</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-21T22:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Writing text Files to a ZIP archive using SAS ODS Package or FILENAME ZIP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-text-Files-to-a-ZIP-archive-using-SAS-ODS-Package-or/m-p/326526#M72729</link>
      <description>&lt;P&gt;Reeza,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately, no.&amp;nbsp; Our environment is a client server configuration and the security protocols don't allow the business users to run the command line on production servers. ODS package and FILENAME ZIP seem to be enabled, but not the X command. That was my first thought as well having built SAS projects in the past.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jan 2017 22:35:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-text-Files-to-a-ZIP-archive-using-SAS-ODS-Package-or/m-p/326526#M72729</guid>
      <dc:creator>Jim_Cooper_hmsa</dc:creator>
      <dc:date>2017-01-21T22:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Writing text Files to a ZIP archive using SAS ODS Package or FILENAME ZIP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-text-Files-to-a-ZIP-archive-using-SAS-ODS-Package-or/m-p/326543#M72733</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1597"&gt;@Jim_Cooper_hmsa&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Without X command you'll have to read the data into SAS before writing it to a zip file which is not an ideal situation as this could alter your data (i.e. change the end-of-line indicator from CR to CRLF).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If such changes are acceptable (or controllable) then below code sample could show you the way.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* create sample text file */
proc export 
  data=sashelp.class 
  dbms=csv 
  outfile="c:\temp\testtext.csv" 
  replace;
run;quit;


/* create and add members to zip archive */
filename foo ZIP 'c:\temp\testzip.zip' lrecl=1000000;

data _null_;
  infile "c:\temp\testtext.csv";
  file foo(test3.csv);
  input;
  put _infile_;
run;

data _null_;
  infile "c:\temp\testtext.csv";
  file foo(test4.csv);
  input;
  put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Jan 2017 23:50:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-text-Files-to-a-ZIP-archive-using-SAS-ODS-Package-or/m-p/326543#M72733</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-01-22T23:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Writing text Files to a ZIP archive using SAS ODS Package or FILENAME ZIP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-text-Files-to-a-ZIP-archive-using-SAS-ODS-Package-or/m-p/326582#M72756</link>
      <description>Patrick,&lt;BR /&gt;I was hoping to avoid converting the data for the reason that you had identified. However, Your solution is acceptable. &lt;BR /&gt;Thanks</description>
      <pubDate>Sun, 22 Jan 2017 14:57:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-text-Files-to-a-ZIP-archive-using-SAS-ODS-Package-or/m-p/326582#M72756</guid>
      <dc:creator>Jim_Cooper_hmsa</dc:creator>
      <dc:date>2017-01-22T14:57:34Z</dc:date>
    </item>
  </channel>
</rss>

