BookmarkSubscribeRSS Feed
Wangya1
Calcite | Level 5

Currently I'm trying to use sas to connect to sftp server. I did some researches, it said in order to use sftp method, I need to install openSSH client software and use key authentication for connection.

 

So I installed puTTY and setup the private/public key. When I test the connection from psftp, I can connect to sftp server without password (use key authentication). As you can see as below, the test file 3.xlsx is on the sftp server.

 
 
 

1.PNG

 

 

 

 

 

 

 

But the problem is when I try to get the same file on sas, it has an error "the file does not exist".

 

Capture.PNG

Inside psftp, I could download this test file on my local pc, I have no idea why I cant do the same thing on sas.

Below is my sas sftp connection code:

 

filename test sftp '/3.xlsx'
optionsx='-P 222 -i x:\PuTTY\privatekey.ppk -pw "XXXXXXX" -V'
host="XXXXXXXX" user="XXXXXXXX" path="x:\PuTTY\psftp.exe" DEBUG;

I would be so appreciate if someone can help me to fix this issue.

 

3 REPLIES 3
ballardw
Super User

By any chance did you try starting that filename statement with

filename test sftp '3.xlsx'

no preceding /

Wangya1
Calcite | Level 5

I tried, its not working. Even if I just want to test with simple cmd like 'LS', I still get error msg like "file '' does not exist'.

ballardw
Super User

I don't know enough, basically nothing, about Putty.

 

Had you found either of these:

https://www.lexjansen.com/sesug/2017/CC-115.pdf

 

https://amadeus.co.uk/tips/retrieving-files-from-an-sftp-site/

 

That seem to provide more concrete details.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 628 views
  • 0 likes
  • 2 in conversation