<?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: Copy files from SAS to FTP serwer in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47555#M9851</link>
    <description>Peter.C.&lt;BR /&gt;
&lt;BR /&gt;
Thanks! Your example is very comprehensible. And it works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
I also write a simple script which can be executed directly from AIX server. Maybe it would be useful for someone.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
#!/bin/ksh&lt;BR /&gt;
&lt;BR /&gt;
HOST='xx.xx.xx.xxx'&lt;BR /&gt;
USER='user'&lt;BR /&gt;
PASSWD='pass'&lt;BR /&gt;
&lt;BR /&gt;
ftp -n  $HOST &amp;lt;&amp;lt;!EOF&lt;BR /&gt;
quote USER $USER&lt;BR /&gt;
quote PASS $PASSWD&lt;BR /&gt;
prompt&lt;BR /&gt;
put filename.zip&lt;BR /&gt;
bye&lt;BR /&gt;
!EOF</description>
    <pubDate>Thu, 23 Dec 2010 14:42:42 GMT</pubDate>
    <dc:creator>Lucas</dc:creator>
    <dc:date>2010-12-23T14:42:42Z</dc:date>
    <item>
      <title>Copy files from SAS to FTP serwer</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47543#M9839</link>
      <description>Hi,&lt;BR /&gt;
I would like to copy some files from my SAS server (UNIX) to another FTP host.&lt;BR /&gt;
&lt;BR /&gt;
The connection beetwen my server and FTP is open (I tried 'ftp xxx.xxx.xxx.xxx' command in PUTTY).</description>
      <pubDate>Thu, 09 Dec 2010 09:41:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47543#M9839</guid>
      <dc:creator>Lucas</dc:creator>
      <dc:date>2010-12-09T09:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Copy files from SAS to FTP serwer</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47544#M9840</link>
      <description>You could use the "X" command to shell out to unix and then have a script that does the FTP.&lt;BR /&gt;
&lt;BR /&gt;
Perhaps you could be more specific about what you are trying to accomplish.</description>
      <pubDate>Thu, 09 Dec 2010 15:03:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47544#M9840</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2010-12-09T15:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: Copy files from SAS to FTP serwer</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47545#M9841</link>
      <description>When copying "SAS files" to another system, there may be OS platform considerations, which warrant your review of the SAS and CEDA topic - search the SAS support website for technical reference documents, as well as SAS-hosted documentation.&lt;BR /&gt;
&lt;BR /&gt;
And, consider using the FILENAME &lt;FILEREF&gt; FTP  technical approach with SAS - again check the SAS support website for DOC and supplementation technical / conference papers.  Do consider that there are OS-specific "companion" guides which may have supplemental info on using FILENAME and the FTP engine.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search arguments, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
sas file transfer ceda site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
filename ftp engine file transfer site:sas.com&lt;/FILEREF&gt;</description>
      <pubDate>Thu, 09 Dec 2010 22:19:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47545#M9841</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-12-09T22:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: Copy files from SAS to FTP serwer</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47546#M9842</link>
      <description>What problem did you meet?&lt;BR /&gt;
What type of files are you need to transfer?If it is dataset or some SAS members file,It better to make a transported file by using proc cport / proc copy.&lt;BR /&gt;
If you only want to transfer some ASIIC files.Just to use some ftp command.&lt;BR /&gt;
&lt;BR /&gt;
1)Login UNIX server&lt;BR /&gt;
2)Enter the directory which contains the files you need to transfer.&lt;BR /&gt;
3)ftp 10.1...enter your username password&lt;BR /&gt;
4)Enter the directory in FTP you want to locate.&lt;BR /&gt;
5)Type command ' binary 80'&lt;BR /&gt;
6)Type command 'put lucas.txt'&lt;BR /&gt;
7)Type command 'bye'&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Fri, 10 Dec 2010 05:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47546#M9842</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-12-10T05:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Copy files from SAS to FTP serwer</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47547#M9843</link>
      <description>Hi,&lt;BR /&gt;
I solved my problem in this way:&lt;BR /&gt;
&lt;BR /&gt;
filename csvFTP ftp "&amp;amp;target_path_ftp/&amp;amp;file_name..csv"&lt;BR /&gt;
         host="&amp;amp;host"&lt;BR /&gt;
         user="&amp;amp;user" password="&amp;amp;pass';&lt;BR /&gt;
&lt;BR /&gt;
proc export data=work.MyTable&lt;BR /&gt;
                     outfile= csvFTP&lt;BR /&gt;
                     dbms=dlm replace;&lt;BR /&gt;
                     delimiter=';';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
But it isn't exactly what I want...&lt;BR /&gt;
&lt;BR /&gt;
Does anyone can help me to do this with "X" command?&lt;BR /&gt;
&lt;BR /&gt;
I need to copy a .csv file from my SAS server (/home/sasuser/test.csv )  to FTP sever (/home/ftpuser).</description>
      <pubDate>Fri, 10 Dec 2010 20:58:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47547#M9843</guid>
      <dc:creator>Lucas</dc:creator>
      <dc:date>2010-12-10T20:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: Copy files from SAS to FTP serwer</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47548#M9844</link>
      <description>Suggest searching the SAS support &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website or the forum archives -- you will want to focus on the SAS "companion" documentation for your OS.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Google advanced search argument, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
x command site:sas.com</description>
      <pubDate>Fri, 10 Dec 2010 22:07:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47548#M9844</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-12-10T22:07:41Z</dc:date>
    </item>
    <item>
      <title>Re: Copy files from SAS to FTP serwer</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47549#M9845</link>
      <description>Hi Ksharp,&lt;BR /&gt;
&lt;BR /&gt;
I would like to do something similar to your solution. &lt;BR /&gt;
But I want to do this automatically.&lt;BR /&gt;
Is it possible to have a script on AIX server that does the FTP commands?</description>
      <pubDate>Wed, 22 Dec 2010 12:44:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47549#M9845</guid>
      <dc:creator>Lucas</dc:creator>
      <dc:date>2010-12-22T12:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Copy files from SAS to FTP serwer</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47550#M9846</link>
      <description>Hi,&lt;BR /&gt;
unfortunately I can't use X commands &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;BR /&gt;
Is there any way to copy files from SAS to FTP server?&lt;BR /&gt;
The files are zip archives.</description>
      <pubDate>Wed, 22 Dec 2010 14:11:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47550#M9846</guid>
      <dc:creator>Lucas</dc:creator>
      <dc:date>2010-12-22T14:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Copy files from SAS to FTP serwer</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47551#M9847</link>
      <description>Use that FTP FILENAME statement that worked for PROC export but refer to it in a data step.  For binary files, use $char format in PUT statements</description>
      <pubDate>Wed, 22 Dec 2010 15:10:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47551#M9847</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-12-22T15:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: Copy files from SAS to FTP serwer</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47552#M9848</link>
      <description>Sorry, but I don't understand what you mean &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; Could you write an example ?

Message was edited by: Lucas</description>
      <pubDate>Wed, 22 Dec 2010 21:30:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47552#M9848</guid>
      <dc:creator>Lucas</dc:creator>
      <dc:date>2010-12-22T21:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Copy files from SAS to FTP serwer</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47553#M9849</link>
      <description>Lucas&lt;BR /&gt;
 &lt;BR /&gt;
before writing to FTP, practise in using SAS to copy files. Here is example 1[pre]data _null_ ;&lt;BR /&gt;
   infile 'a simple text file.txt' lrecl=10000 ;&lt;BR /&gt;
   file 'a copy.txt' lrecl=10000 ;&lt;BR /&gt;
   input ;&lt;BR /&gt;
   put _infile_ ;&lt;BR /&gt;
run; [/pre]* notice that lrecl. It ensures you use up to 10000 of each line.&lt;BR /&gt;
Example 2: using filename statements ; [pre]filename ffrom 'a simple text file.txt' lrecl=10000 ;&lt;BR /&gt;
filename fileTO  'a copy.txt' lrecl=10000 ;&lt;BR /&gt;
data _null_ ;&lt;BR /&gt;
   infile ffrom ;&lt;BR /&gt;
   file   fileto ;&lt;BR /&gt;
   input ;&lt;BR /&gt;
   put _infile_ ;&lt;BR /&gt;
run; [/pre] * see how similar. Just using file refs instead;&lt;BR /&gt;
* next Example 3 making a binary copy;[pre]filename ffrom 'a binary file.stc' lrecl=80 recfm=F ; [/pre] * and fill it with a cport file ;[pre]proc cport data= sashelp.class file= ffrom; &lt;BR /&gt;
run ;[/pre] * might as well be something familiar ;[pre]filename fileTO  'copy of cport.stc' lrecl=80 recfm= f ;&lt;BR /&gt;
data _null_ ;&lt;BR /&gt;
   infile ffrom  pad ;&lt;BR /&gt;
   file   fileto ;&lt;BR /&gt;
   input ;&lt;BR /&gt;
   put _infile_ ;&lt;BR /&gt;
run;[/pre]* and lets check it is OK ;[pre]proc cimport lib= work file= fileto ; &lt;BR /&gt;
run; [/pre] * beginnng to look familiar? ;&lt;BR /&gt;
* I guess you noticed an extra thing on the INFILE statement. That PAD option ensures the end-of-file coming inside the multiple of 80 will not cause trouble;&lt;BR /&gt;
* finally the FTP Example ;&lt;BR /&gt;
* just use your FTP filename statement with, perhaps no more;[pre]filename myFTP ftp "&amp;amp;target_path_ftp/&amp;amp;file_name..stc" binary lrecl= 80 recfm=F ;&lt;BR /&gt;
* you already have a binary file defined;&lt;BR /&gt;
data _null_ ;&lt;BR /&gt;
   infile ffrom  pad ;&lt;BR /&gt;
   file   fileto ;&lt;BR /&gt;
   input ;&lt;BR /&gt;
   put _infile_ ;&lt;BR /&gt;
run;[/pre] * and you will have to try that yourself;&lt;BR /&gt;
OK The transfer over FTP should define binary in the filename statement for a binary file especially when transferring to a different encoding system (like zOS in ebcdic from an ascii environment like windows or unix). You may want to transfer only text. In that case drop the RECFM= and set LRECL= to a size at least large enough for your widest line.&lt;BR /&gt;
is that enough example?&lt;BR /&gt;
 &lt;BR /&gt;
good luck &lt;BR /&gt;
 &lt;BR /&gt;
peterC&lt;BR /&gt;
&lt;BR /&gt;
doc for filenameFT  is at &lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/63026/HTML/default/viewer.htm#a000178980.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/63026/HTML/default/viewer.htm#a000178980.htm&lt;/A&gt;</description>
      <pubDate>Thu, 23 Dec 2010 00:37:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47553#M9849</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-12-23T00:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: Copy files from SAS to FTP serwer</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47554#M9850</link>
      <description>Sorry.&lt;BR /&gt;
I have not such experience.Maybe Google would help you a little bit.&lt;BR /&gt;
Or just write some UNIX shell script.</description>
      <pubDate>Thu, 23 Dec 2010 03:22:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47554#M9850</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-12-23T03:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: Copy files from SAS to FTP serwer</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47555#M9851</link>
      <description>Peter.C.&lt;BR /&gt;
&lt;BR /&gt;
Thanks! Your example is very comprehensible. And it works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
I also write a simple script which can be executed directly from AIX server. Maybe it would be useful for someone.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
#!/bin/ksh&lt;BR /&gt;
&lt;BR /&gt;
HOST='xx.xx.xx.xxx'&lt;BR /&gt;
USER='user'&lt;BR /&gt;
PASSWD='pass'&lt;BR /&gt;
&lt;BR /&gt;
ftp -n  $HOST &amp;lt;&amp;lt;!EOF&lt;BR /&gt;
quote USER $USER&lt;BR /&gt;
quote PASS $PASSWD&lt;BR /&gt;
prompt&lt;BR /&gt;
put filename.zip&lt;BR /&gt;
bye&lt;BR /&gt;
!EOF</description>
      <pubDate>Thu, 23 Dec 2010 14:42:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copy-files-from-SAS-to-FTP-serwer/m-p/47555#M9851</guid>
      <dc:creator>Lucas</dc:creator>
      <dc:date>2010-12-23T14:42:42Z</dc:date>
    </item>
  </channel>
</rss>

