I'm unable to import a file from Remote server using SFTP. I tried the following code, but the code has failed with the error. I verified SFTP connection from our SAS Grid server and credentials looks fine. I am able to import the file using SFTP client which means I confirm that file exists in the directory.
data aaaa;
a=1;
run;
FILENAME in SFTP '/IN/SNAP/CAT_20170705171730.txt' LRECL=256
HOST='sftp://babloo_SFTP@b2b.cabdo.com'
USER='babloo_SFTP'
;
DATA _NULL_;
INFILE in;
INPUT HOUSEHOLD_ID;
RUN;
PROC PRINT DATA=_NULL_(obs=10);
RUN;
Snippet from Log:
34 DATA _NULL_;
35 INFILE in;
36 INPUT HOUSEHOLD_ID;
37 RUN;
2 The SAS System 08:49 Wednesday, July 5, 2017
NOTE: cd /IN/SNAP
ERROR: Directory or file /IN/SNAP/CAT_20170705171730.txt doesn't exist.
NOTE: The SAS System stopped processing this step because of errors
Log on to the server with sftp (you do have public/private key authentication enabled?), change to the directory, do a ls there, and then post a copy/paste of the whole process here.
sftp> dir
IN
sftp> pwd
sftp> cd /IN/SNAP
sftp> ls
CAT_20170705171730.txt
sftp> pwd
Remote working directory: /IN/SNAP
sftp>
Reduce the host= in your code to the bare hostname:
FILENAME in SFTP '/IN/SNAP/CAT_20170705171730.txt' LRECL=256
HOST='b2b.cabdo.com'
USER='babloo_SFTP'
;
No protocol and/or username necessary and allowed there.
Well, I tried something similar (filename sftp from a Linux server), and when I added the "sftp://username@" to the host name, I got exactly your error message.
Please post the log of the complete step, from filename statement to the ERROR message.
28 FILENAME in SFTP '/Babloo_SFTP/IN/SNAP/CAT_20170705171730.txt'
29 HOST="Babloo_SFTP@b2b.cabdo.com"
30 USER='Bablopp_SFTP'
31 ;
32
33 DATA _NULL_;
34 INFILE in;
35 INPUT HOUSEHOLD_ID;
36 RUN;
NOTE: cd /Babloo_SFTP/IN/SNAP/CAT_20170705171730.txt
2 The SAS System 08:49 Wednesday, July 5, 2017
ERROR: Directory or file /Babloo_SFTP/IN/SNAP/CAT_20170705171730.txt doesn't exist.
NOTE: The SAS System stopped processing this step because of errors.
WOULD YOU PLEASE CARE TO READ AND IMPLEMENT MY POSTS?
Drop the "Babloo_SFTP@" from the hostname!!!
Since you probably don't want to reveal the real host-/user/filenames so we could test from our SAS (or the server won't be reachable from outside), it's best you open a track with SAS technical support.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.