SAS: PROC IMPORT on a FILENAME SFTP fileref -


in sas (9.4, if matters) grab csv file remote host via sftp, parse csv, , drop result sas data table.

i set sftp using putty described in sas docs. binding fileref sftp works okay, like:

filename mysftpfileref sftp 'location/on/host/file.csv' host='myhost' user='mysuser'; data _null_;     infile mysftpfileref truncover;     input $25.; run; 

will read data.

however, can't seem figure out use proc import parse data. docs proc state

"the import procedure not support device types or access methods filename statement except disk. example, import procedure not support temp device type, creates temporary external file."

is there workaround?

you'll need either:

  • write import code (using data step)
  • download file in fashion , run proc import on downloaded file

if choose second option, can few ways. easiest write above data step, read entire line in or use _infile_ automatic variable, , write out locally. along these lines (define these filenames or change them, of course):

data _null_;  infile sftpfile;  file localf;  input @;  put _infile_; run; 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -