0
votes

I am not very technical so please bear with me while I try to explain the problem. We have a daily scheduled job that kicks off a SAS program on a Unix server. The program analyzes data and spits out a CSV file which gets stored on the server and then emailed to me. I then manually download the file from email and upload it to a utility to process the file. I am looking for a way to bypass the manual steps and instead have the SAS program upload the CSV file directly to a folder on the server for the file processing utility.

So given that the csv file is stored on the server that SAS is connected to (/user/folder/file.csv) how can I transport this file to another folder (/inbox) on another server (server2.test.com)?

Here is what I have so far, but I think I am missing something because the file isn't making it to the folder:

proc import file="/user/folder/file.csv"    
            dbms=csv out=file1 replace;     
run;

filename outdir ftp "/inbox"  DIR
                    host="server2.test.com" 
                    user="username" pass="pwd";

data _null_;
   file outdir(file1);
   put file1;
run;

Thanks!

Mike

1

1 Answers

0
votes

You are close. I would define one filename for the reading the CSV file and one for writing to the FTP server.

filename in "/user/folder/file.csv";
filename outdir ftp "/inbox"  DIR
                host="server2.test.com" 
                user="username" pass="pwd"
;

Then copy the file.

data _null_;
  infile in;
  file outdir("file.csv");
  input;
  put _infile_;
run;