11-30-2016 07:13 AM
I want to create one of the sas datset in SFTP server in CSV format.I tried below test code to create file in SFTP server,but i could not connect to FTP server.
I also tried to connect to SFTP with libname statement but even that not work.
FILENAME targetSFTP "/xx/test.csv" HOST = 'xx-xx.xx.xx.com' DEBUG;
do i=1 to 10;
Please help me to get it done in two ways with filename and libname.
Thanks in advance
11-30-2016 07:16 AM
To use filename sftp, password-free authentication needs to be in place. Make sure that you have public/private key authentication set up for the userID's involved.
Also post the log for steps that don't work. Without the log, everything else is guesswork.
11-30-2016 07:26 AM
Thans for your quick response.I did not understand this public and private keys.
But i have username and password for this SFTP server.I read that we should not use password for SFTP server so i have run only with username.
Please find the below log file
22 GOPTIONS ACCESSIBLE;
23 FILENAME target1 SFTP USER='xx' HOST = 'xx.xx.xxx.com' DEBUG;
24 data _null_;
25 file target1;
26 do i=1 to 10;
27 put i=;
NOTE: Connecting to xxxx-xx.xxt.xx.com...
NOTE: The file TARGET1 is:
NOTE: ssh: connect to host xxxx.xx.xxt.com port 22: Connection timed out
NOTE: 10 records were written to the file TARGET1.
The minimum record length was 3.
The maximum record length was 4.
NOTE: DATA statement used (Total process time):
real time 1:03.21
cpu time 0.02 seconds
11-30-2016 07:30 AM
You have to set up password-free authentication, or SFTP won't work from SAS.
Do a google search for
ssh key-based authentication
and you will find all necessary information.