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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1188 views
  • 0 likes
  • 2 in conversation