<?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: FTP within SAS program in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/FTP-within-SAS-program/m-p/64565#M18332</link>
    <description>I was able to figure out how to write to a file on a remote host using ftp. &lt;BR /&gt;
&lt;BR /&gt;
I used the code given below(It directly writes to remote file from ods. My previous post was little different use case. But right now I am trying to get this working)&lt;BR /&gt;
&lt;BR /&gt;
----------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
data sasProgData;&lt;BR /&gt;
&lt;BR /&gt;
INFILE "C:\SAS\Samples\ADDVAR.SAS" DLM = ';';&lt;BR /&gt;
&lt;BR /&gt;
LENGTH SASProgramText $ 200 ;&lt;BR /&gt;
&lt;BR /&gt;
INPUT SASProgramText;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
filename myfile ftp 'sasProg1.txt'&lt;BR /&gt;
         host="myhost.mydomain.com" recfm=s lrecl=80&lt;BR /&gt;
         user="myUser"&lt;BR /&gt;
         pass="myPass";&lt;BR /&gt;
&lt;BR /&gt;
ods rtf file=myfile;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=sasProgData;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
ods listing close;&lt;BR /&gt;
&lt;BR /&gt;
----------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
For the above to work, file sasProg1.txt has to be created on the remote machine before executing the program. Else it complains no physical file existing. &lt;BR /&gt;
&lt;BR /&gt;
My question is how do I create file(and also folders) on the remote machine?&lt;BR /&gt;
I want to create some specific folder structure during runtime and then write the files in appropriate folder on the remote machine.&lt;BR /&gt;
&lt;BR /&gt;
Apprecite any help!&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Neel</description>
    <pubDate>Fri, 14 Aug 2009 16:24:13 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-08-14T16:24:13Z</dc:date>
    <item>
      <title>FTP within SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/FTP-within-SAS-program/m-p/64563#M18330</link>
      <description>Hi All,&lt;BR /&gt;
&lt;BR /&gt;
Wanted some help understanding use of ftp within a SAS program to transfer files from one machine to another. Right now I am trying to transfer from a windows machine to another windows machine which is a ftp server&lt;BR /&gt;
&lt;BR /&gt;
Say I have a file C:\Folder1\test.txt on machine A and want to transfer this file to folder &lt;BR /&gt;
B on the FTP server machine, can anybody point to what the syntax will be like.&lt;BR /&gt;
&lt;BR /&gt;
I saw some examples like&lt;BR /&gt;
&lt;BR /&gt;
 filename myfile ftp &lt;BR /&gt;
  cd="\B" host="MyFTPHost" recfm=s&lt;BR /&gt;
         user="anonymous"&lt;BR /&gt;
         pass="";&lt;BR /&gt;
&lt;BR /&gt;
I am not sure where do I specify the source content that I need to send through ftp. In my example where do I specify the source location C:\Folder1\test.txt?&lt;BR /&gt;
&lt;BR /&gt;
Any help?&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Neel</description>
      <pubDate>Thu, 13 Aug 2009 21:10:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/FTP-within-SAS-program/m-p/64563#M18330</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-13T21:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: FTP within SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/FTP-within-SAS-program/m-p/64564#M18331</link>
      <description>The "remote" FTP server must be configured for access on one or more volumes - normally one as I recall.  You may be able to accommodate the rqmt within the FTP server configuration, however it would not be a drive-letter technique.  Check with your FTP server admin, possibly a sub-domain maybe?&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 13 Aug 2009 22:59:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/FTP-within-SAS-program/m-p/64564#M18331</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-08-13T22:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: FTP within SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/FTP-within-SAS-program/m-p/64565#M18332</link>
      <description>I was able to figure out how to write to a file on a remote host using ftp. &lt;BR /&gt;
&lt;BR /&gt;
I used the code given below(It directly writes to remote file from ods. My previous post was little different use case. But right now I am trying to get this working)&lt;BR /&gt;
&lt;BR /&gt;
----------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
data sasProgData;&lt;BR /&gt;
&lt;BR /&gt;
INFILE "C:\SAS\Samples\ADDVAR.SAS" DLM = ';';&lt;BR /&gt;
&lt;BR /&gt;
LENGTH SASProgramText $ 200 ;&lt;BR /&gt;
&lt;BR /&gt;
INPUT SASProgramText;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
filename myfile ftp 'sasProg1.txt'&lt;BR /&gt;
         host="myhost.mydomain.com" recfm=s lrecl=80&lt;BR /&gt;
         user="myUser"&lt;BR /&gt;
         pass="myPass";&lt;BR /&gt;
&lt;BR /&gt;
ods rtf file=myfile;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=sasProgData;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
ods listing close;&lt;BR /&gt;
&lt;BR /&gt;
----------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
For the above to work, file sasProg1.txt has to be created on the remote machine before executing the program. Else it complains no physical file existing. &lt;BR /&gt;
&lt;BR /&gt;
My question is how do I create file(and also folders) on the remote machine?&lt;BR /&gt;
I want to create some specific folder structure during runtime and then write the files in appropriate folder on the remote machine.&lt;BR /&gt;
&lt;BR /&gt;
Apprecite any help!&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Neel</description>
      <pubDate>Fri, 14 Aug 2009 16:24:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/FTP-within-SAS-program/m-p/64565#M18332</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-14T16:24:13Z</dc:date>
    </item>
    <item>
      <title>Re: FTP within SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/FTP-within-SAS-program/m-p/64566#M18333</link>
      <description>FIrst, you need to CLOSE the "ODS RTF" after the PROC PRINT.  If you are still having errors with the FILENAME execution, reply with the COPY/PASTE info from your SAS execution log and provide specific error messages, along with the SAS log and the code being executed.&lt;BR /&gt;
&lt;BR /&gt;
Then, if you need to create a remote server directory, you will need review the appropriate SAS companion guide and explore using the FILENAME PIPE engine to execute remote system commands.  I have pasted the related UNIX companion guide - there is one for each supported platform, available at the SAS support &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website for reference and use.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/hostunx/61879/HTML/default/pipe.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/hostunx/61879/HTML/default/pipe.htm&lt;/A&gt;</description>
      <pubDate>Fri, 14 Aug 2009 16:35:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/FTP-within-SAS-program/m-p/64566#M18333</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-08-14T16:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: FTP within SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/FTP-within-SAS-program/m-p/64567#M18334</link>
      <description>Thanks for the response. I have the close statement for ODS. It was just that I was trying RTF because I was not getting the listing lines wrapped in text file. &lt;BR /&gt;
&lt;BR /&gt;
So about FTP, when I don't have the file sasProg1.txt in FTP root folder of the remote machine I get the error "ERROR: Physical file does not exist, sasProg1.txt." . Part of log is given below. &lt;BR /&gt;
&lt;BR /&gt;
------------------------------------------------------------------------------------&lt;BR /&gt;
89   filename myfile ftp 'sasProg1.txt'&lt;BR /&gt;
90            host="sashost.dag.com" recfm=s lrecl=80&lt;BR /&gt;
91            user="Administrator"&lt;BR /&gt;
92            pass=XXXXXXXXXXXXX;&lt;BR /&gt;
93&lt;BR /&gt;
94   ods listing file=myfile;&lt;BR /&gt;
NOTE: 220 Microsoft FTP Service&lt;BR /&gt;
ERROR: Physical file does not exist, sasProg1.txt.&lt;BR /&gt;
95&lt;BR /&gt;
96   proc print data=sasProgData;&lt;BR /&gt;
97   run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: There were 73 observations read from the data set WORK.SASPROGDATA.&lt;BR /&gt;
NOTE: PROCEDURE PRINT used (Total process time):&lt;BR /&gt;
      real time           0.01 seconds&lt;BR /&gt;
      cpu time            0.01 seconds&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
98&lt;BR /&gt;
99   ods listing close;&lt;BR /&gt;
-----------------------------------------------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
I don't know how it is supposed to behave. I thought it is expecting the sasProg1.txt to exist locally in the current directory. So I created dummy file with name sasProg1.txt&lt;BR /&gt;
in current directory where the SAS program is, Still it complained about physical file not existing. When I created the file sasProg1.txt on remote machine it works and writes the contents from proc print to it.</description>
      <pubDate>Fri, 14 Aug 2009 17:52:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/FTP-within-SAS-program/m-p/64567#M18334</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-14T17:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: FTP within SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/FTP-within-SAS-program/m-p/64568#M18335</link>
      <description>I am trying to do FTP after creating the file locally. I use the below code to create file locally&lt;BR /&gt;
----------------------------------------------------------------&lt;BR /&gt;
data sasProgData;&lt;BR /&gt;
&lt;BR /&gt;
INFILE "C:\DAG\SAS\Samples\ADDVAR.SAS" DLM = ';';&lt;BR /&gt;
&lt;BR /&gt;
LENGTH SASProgramText $ 200 ;&lt;BR /&gt;
&lt;BR /&gt;
INPUT SASProgramText;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
ods listing file='C:\Neelam\ProgFiles\sasProg1.txt';&lt;BR /&gt;
&lt;BR /&gt;
ods listing file=myfile;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=sasProgData;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
ods listing close;&lt;BR /&gt;
-------------------------------------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
After this, if I want to ftp the locally created file to the remote server, can anybody help me to figure out how the syntax should be?&lt;BR /&gt;
&lt;BR /&gt;
Appreciate any help.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Neelam</description>
      <pubDate>Fri, 14 Aug 2009 19:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/FTP-within-SAS-program/m-p/64568#M18335</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-14T19:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: FTP within SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/FTP-within-SAS-program/m-p/64569#M18336</link>
      <description>I didn't know the FTP filename engine could be used for ODS output, though you seem to have succeeded.&lt;BR /&gt;
You can use the FTP filename in a data step to either:&lt;BR /&gt;
&lt;BR /&gt;
- &lt;U&gt;create an empty remote file and use the ODS to FTP output in post 1, like:&lt;/U&gt;&lt;BR /&gt;
filename myftp ftp 'sasProg1.txt' ...;&lt;BR /&gt;
data _null_; *create empty file before output;&lt;BR /&gt;
  file myftp;&lt;BR /&gt;
  put ' ';&lt;BR /&gt;
run;&lt;BR /&gt;
ods rtf file=myftp;&lt;BR /&gt;
[.. create file ..]&lt;BR /&gt;
&lt;BR /&gt;
- &lt;U&gt;transfer the file you have created locally in the post above, like:&lt;/U&gt;&lt;BR /&gt;
[.. create file ..]&lt;BR /&gt;
ods listing close;&lt;BR /&gt;
data _null_;&lt;BR /&gt;
  file myftp;&lt;BR /&gt;
  infile myfile;&lt;BR /&gt;
  input;&lt;BR /&gt;
  put _infile_;&lt;BR /&gt;
run;</description>
      <pubDate>Tue, 18 Aug 2009 01:23:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/FTP-within-SAS-program/m-p/64569#M18336</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-08-18T01:23:08Z</dc:date>
    </item>
  </channel>
</rss>

