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-2024.png

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

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