BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
dipand
Quartz | Level 8

Hello to all, I have to transfer a file from the sas server to another via SFTP connection. My system administrator installed the private key on the server. I try to run the following code:

 


filename out sftp "SPM_KPI_HSEQALL_MAY2023.csv" host='XXXXXXX' debug
cd='01_IMPORTED_KPI' user='XXXXX' optionsx='-i  /home/risorse/asea007/.ssh/SPM_PVTK.ppk -pw "XXXXXX"';

data _null_;
infile "/sasgrid/hseq/1_0/SPM_KPI_HSEQALL_MAY2023.csv" recfm=n ;
input x $char1. @@;
file out recfm=s;
put x $char1. @@;
run;

 

Can you help me figure out if there’s something wrong with the code?

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
dipand
Quartz | Level 8

Hi resolved, there was a problem with key authoritazion.

the correct code:

 


filename out sftp "SPM_KPI_HSEQALL_MAY2023.csv"  host='XXXXXXXXX' debug
cd='01_IMPORTED_KPI' user='XXXXXXXXX' optionsx='-i /home/aaa/.ssh/SPM_PVTK.ppk';

data _null_;
infile "/sasgrid/hseq/1_0/SPM_KPI_HSEQALL_MAY2023.csv" recfm=n ;
input x $char1. @@;
file out recfm=s;
put x $char1. @@;
run;

 

Than you 

View solution in original post

4 REPLIES 4
ballardw
Super User

And the text of the actual error is?

 

Need to see the actual error message(s). You may need to provide the log of the entire code as things with libnames that aren't reported as errors sometimes make them unusable for specific tasks.

 


@dipand wrote:

Hello to all, I have to transfer a file from the sas server to another via SFTP connection. My system administrator installed the private key on the server. I try to run the following code:

 


filename out sftp "SPM_KPI_HSEQALL_MAY2023.csv" host='XXXXXXX' debug
cd='01_IMPORTED_KPI' user='XXXXX' optionsx='-i  /home/risorse/asea007/.ssh/SPM_PVTK.ppk -pw "XXXXXX"';

data _null_;
infile "/sasgrid/hseq/1_0/SPM_KPI_HSEQALL_MAY2023.csv" recfm=n ;
input x $char1. @@;
file out recfm=s;
put x $char1. @@;
run;

 

Can you help me figure out if there’s something wrong with the code?

 

Thank you


 

dipand
Quartz | Level 8

@ballardw  

the error is :

The folder or file doesn't exist.

 

NOTE: unknown option -- w
usage: sftp [-1246aCfpqrv] [-B buffer_size] [-b batchfile] [-c cipher]
[-D sftp_server_path]
[-F ssh_config] [-i identity_file] [-l limit]
[-o ssh_option] [-P port] [-R num_requests] [-S program]
 
[-s subsystem | sftp_server] host
sftp [user@]host[:file ...]
sftp [user@]host[:dir[/]]
sftp -b
batchfile [user@]host
 
 
 
 

 

 

 

 

 

dipand
Quartz | Level 8

If I delete the options -pw because  my SAS administrator has installed the key on server , the error that I recieve is:

 

Error:

Couldn't read packet: Connection reset by peer

dipand
Quartz | Level 8

Hi resolved, there was a problem with key authoritazion.

the correct code:

 


filename out sftp "SPM_KPI_HSEQALL_MAY2023.csv"  host='XXXXXXXXX' debug
cd='01_IMPORTED_KPI' user='XXXXXXXXX' optionsx='-i /home/aaa/.ssh/SPM_PVTK.ppk';

data _null_;
infile "/sasgrid/hseq/1_0/SPM_KPI_HSEQALL_MAY2023.csv" recfm=n ;
input x $char1. @@;
file out recfm=s;
put x $char1. @@;
run;

 

Than you 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 4 replies
  • 1197 views
  • 0 likes
  • 2 in conversation