<?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: Create text file within a zip archive on a remote server using SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-text-file-within-a-zip-archive-on-a-remote-server-using/m-p/374449#M89663</link>
    <description>&lt;P&gt;After creating the zip file locally, you can use filename ftp with recfm=n to transfer the file:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename target ftp 'filename' host='host' user='user' pass='password';
filename source 'somefile.zip';

data _null_;
infile source recfm=n;
file target recfm=n;
input char $1.;
put char $1.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(untested)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally, I'd prefer to use a external utility like sftp to transfer the zip file.&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jul 2017 11:43:54 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-07-10T11:43:54Z</dc:date>
    <item>
      <title>Create text file within a zip archive on a remote server using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-text-file-within-a-zip-archive-on-a-remote-server-using/m-p/374441#M89660</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;wanted to&amp;nbsp;to create a zipped text file on a remote server using SAS. Base SAS 9.4&amp;nbsp;is running on a&amp;nbsp;Unix platform while the remote server runs Windows. So far I used to create&amp;nbsp;text files on the remote server directly using FILENAME FTP statement. I stumbled upon FILENAME ZIP statement to create files directly&amp;nbsp;within zip archives. But this only seems to work for files I want to create locally. I tried running FILENAME FTP and ZIP in the same statement and they don't seem to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One approach I'd thought of&amp;nbsp;was to use FILENAME ZIP&amp;nbsp;to create&amp;nbsp;text files within&amp;nbsp;zip archives locally and then use a&amp;nbsp;FTP&amp;nbsp;script to copy these to the remote server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd appreciate some pointers on getting this done natively through SAS, if at all that's possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 11:17:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-text-file-within-a-zip-archive-on-a-remote-server-using/m-p/374441#M89660</guid>
      <dc:creator>sauravs3n</dc:creator>
      <dc:date>2017-07-10T11:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Create text file within a zip archive on a remote server using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-text-file-within-a-zip-archive-on-a-remote-server-using/m-p/374449#M89663</link>
      <description>&lt;P&gt;After creating the zip file locally, you can use filename ftp with recfm=n to transfer the file:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename target ftp 'filename' host='host' user='user' pass='password';
filename source 'somefile.zip';

data _null_;
infile source recfm=n;
file target recfm=n;
input char $1.;
put char $1.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(untested)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally, I'd prefer to use a external utility like sftp to transfer the zip file.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 11:43:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-text-file-within-a-zip-archive-on-a-remote-server-using/m-p/374449#M89663</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-10T11:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: Create text file within a zip archive on a remote server using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-text-file-within-a-zip-archive-on-a-remote-server-using/m-p/374799#M89782</link>
      <description>&lt;P&gt;Thanks Kurt!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I gave this a try but I got an error message saying Invalid option for recfm in the file statement.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 06:03:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-text-file-within-a-zip-archive-on-a-remote-server-using/m-p/374799#M89782</guid>
      <dc:creator>sauravs3n</dc:creator>
      <dc:date>2017-07-11T06:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Create text file within a zip archive on a remote server using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-text-file-within-a-zip-archive-on-a-remote-server-using/m-p/374809#M89787</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12773"&gt;@sauravs3n&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thanks Kurt!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I gave this a try but I got an error message saying Invalid option for recfm in the file statement.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I did some testing, and now I think this is the working version:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename target ftp 'filename' host='host' user='user' pass='password';
filename source 'somefile.zip';

data _null_;
infile source recfm=n;
file target recfm=s;
input char $char1.;
put char $char1.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The $char formats are necessary to avoid conversion of dots to blanks (because SAS misunderstands this for missing values when only $1. is used).&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 06:44:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-text-file-within-a-zip-archive-on-a-remote-server-using/m-p/374809#M89787</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-11T06:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Create text file within a zip archive on a remote server using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-text-file-within-a-zip-archive-on-a-remote-server-using/m-p/374819#M89793</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; wrote:&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12773"&gt;@sauravs3n&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;Thanks Kurt!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I gave this a try but I got an error message saying Invalid option for recfm in the file statement.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I did some testing, and now I think this is the working version:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename target ftp 'filename' host='host' user='user' pass='password';
filename source 'somefile.zip';

data _null_;
infile source recfm=n;
file target recfm=s;
input char $char1.;
put char $char1.;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The $char formats are necessary to avoid conversion of dots to blanks (because SAS misunderstands this for missing values when only $1. is used).&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works great! Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One additional change I had to do while creating the text file within the zip archive locally was to add TERMSTR=CRLF to the file statement to enable the text file to display properly on windows. The text file would otherwise display all the data in a single line.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 07:28:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-text-file-within-a-zip-archive-on-a-remote-server-using/m-p/374819#M89793</guid>
      <dc:creator>sauravs3n</dc:creator>
      <dc:date>2017-07-11T07:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Create text file within a zip archive on a remote server using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-text-file-within-a-zip-archive-on-a-remote-server-using/m-p/374822#M89795</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12773"&gt;@sauravs3n&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;One additional change I had to do while creating the text file within the zip archive locally was to add TERMSTR=CRLF to the file statement to enable the text file to display properly on windows. The text file would otherwise display all the data in a single line.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This depends on the software used to display the text file. While notepad needs the additional CR, more advanced text editors like Notepad++ can handle it, like most (or all) of the word processors.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 07:33:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-text-file-within-a-zip-archive-on-a-remote-server-using/m-p/374822#M89795</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-11T07:33:31Z</dc:date>
    </item>
  </channel>
</rss>

