5Feb/120
Accessing files via SFTP in SAS
Secure File Transfer Protocol has become the standard for transferring files outside our organization. However, it is not always the easiest thing to do in SAS. Here are a few code examples for you to steal.
Importing a CSV file over SFTP:
%let host=afhood.com;
%let sftpOption=-o IdentityFile=/home/user/.ssh/id_rsa;
%let filename=theFile.csv;
%let sftpPath=/home/remoteuser/dir/;
filename myfile sftp "&sftpPath.&filename." host="&host." options="&sftpOption.";
proc import datafile= myfile
out=sftp_file
dbms=dlm
replace;
delimiter= ",";
getnames=yes;
run;
If you have any SFTP related questions, or need help building your automated file retrieval, let us know.