Help using Base SAS procedures

Exporting to a FTP site

Reply
N/A
Posts: 0

Exporting to a FTP site

Hi

Is it possible to export to a FTP site, all i want to do is simply upload 5 files,
Files=01-05,
Host=example.com
username=user
password=pass

Thanks
Super User
Posts: 5,260

Re: Exporting to a FTP site

See the online doc for FILENAME FTP statement (if you want to do it within SAS). Otherwise you can create a shell script with your ftp commands, which you can call from a SAS session using the X statement.

Regards,
Linus
Data never sleeps
N/A
Posts: 0

Re: Exporting to a FTP site

The example on the online says:
"This example creates a file called test.dat in a directory called c:\remote for the user bbailey on the host winnt.pc.

filename create ftp 'c:\remote\test.dat'
host='winnt.pc'
user='bbailey' prompt recfm=v;

data _null_;
file create;
do i=1 to 10;
put i=;
end;
run;
"

So i changed it to be:
filename create ftp '\\Daily\yyyymmdd\File01.xls'
host='example.com'
user='user' pass='pass' recfm=v;

data _null_;
file create;
do i=1 to 10;
put i=;
end;
run;
"

But to no success
And how does it know what data source the file to be created is called?
Super Contributor
Super Contributor
Posts: 3,174

Re: Exporting to a FTP site

The DATA step, in general, is the source, even if there is no SET statement. Suggest you set the FILEMSGS option for more complete diagnostics. Also, you should consider sharing SASLOG output (and local/foreign FTP environments, SAS version info) for more accurate assistance/guidance from forum members -- your first DATA step should have worked fine, presuming you are able to FTP to that machine outside of SAS, with native FTP client on your OS platform. Recommend that you first confirm you are able to use FTP (native), and then with FILEMSGS set, test FTP under SAS.

Scott Barry
SBBWorks, Inc.
N/A
Posts: 0

Re: Exporting to a FTP site

Hi

I have come back to this problem...i had a break on some other work, but back on it now.
If my file i want export is called fred1 how do i export this to the FTP site above?

thanks
Super User
Posts: 5,260

Re: Exporting to a FTP site

I suggest you first try to ftp a file from the directory that you are starting SAS from. If you succeed with that, go on using the diagnostics Scott talks about in the previous message.

/Linus
Data never sleeps
Ask a Question
Discussion stats
  • 5 replies
  • 141 views
  • 0 likes
  • 3 in conversation