I am trying SFTP files (SAS data or tokens) from one server to another server in SAS

This is the first time I am trying to use SFTP files using SAS.I tried using the file name operator but was getting some errors.

%let _user=userid;
  filename source sftp 'input.sas7bdat' user="&_user" pass='password'
                  host='server1.net' CD="/home/userid/test/data"
                  DEBUG;
  filename target sftp 'input.sas7bdat' user="&_user" pass='password'
                  host='server2.net' CD="/home/userid/target/sftp_out"
                  DEBUG;
  data _null_;
    infile source;
    input;
    file target;
    put _infile_;
 run;

      

I am getting the following error

18       !         user="&_user" pass='password'
                                 ____
                                 23
ERROR 23-2: Invalid option name pass.

      

Thanks Sam.

+3


source to share


2 answers


The motor does SFTP Filename

not have a password parameter. SAS recommends using public key authentication.



You can use the option optionsx='-pw "YourP@ssw0rd!"'

if you need to provide a password. optionsx

will XXX output the values ​​in the log.

+3


source


As Dom points out, you are not going to include the password in your code to connect via SFTP, and therefore the option is not supported (mostly). See the documentation for SFTP access method for more details .

To set up a method for verifying a public key, you need to create an SSH key pair. The server owner must do this; if you find it, you can find instructions for doing it online, for example [here] 1 ( http://www.hasug.org/newsletters/hasug201202/Using_Secure_Shell_with_SASr_Software.pdf ). SAS also contains a detailed document containing instructions for this process on the support site .

Once you have been provided with the SSH key, you save it in an appropriate location based on your environment and log in once interactively using PuTTY or another SSH client. See this client documentation for where exactly the SSH public key file can be placed. When you log in using this public key, you may be prompted to add it to the list approved on your computer (say yes).



You can also see this SuperUser question , which has a similar set of instructions.

1 Rickards, Clint, "Using Secure Shell with SAS Software," HASUG 2012.

0


source







All Articles