BookmarkSubscribeRSS Feed
Babloo
Rhodochrosite | Level 12

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
9 REPLIES 9
Kurt_Bremser
Super User

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.

Babloo
Rhodochrosite | Level 12

sftp> dir
IN
sftp> pwd
sftp> cd /IN/SNAP
sftp> ls
CAT_20170705171730.txt
sftp> pwd
Remote working directory: /IN/SNAP
sftp>

Kurt_Bremser
Super User

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.

Babloo
Rhodochrosite | Level 12
I tried this already, but still receiving the same error message.

##- Please type your reply above this line. Simple formatting, no
attachments. -##
Kurt_Bremser
Super User

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.

Babloo
Rhodochrosite | Level 12
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.
Babloo
Rhodochrosite | Level 12
I'm still receiving the same error message when I drop 'Babloo_SFTP@'.

##- Please type your reply above this line. Simple formatting, no
attachments. -##
Kurt_Bremser
Super User

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.

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 9 replies
  • 1433 views
  • 3 likes
  • 2 in conversation