Bancova News and Announcements

SAS FTP

 
 
Picture of John Zhang
SAS FTP
by John Zhang - Monday, 9 November 2015, 8:14 PM
 

%macro sasftp(localdir=%str(c:/mytools/sasweb/pages),
	localfile=,
	remotefile=,
	remotedir=,
	host=webxxx.webxxx.com,
	username=sas,
	password=%str(password),
	ftptype=put); 

filename rmfile ftp "&remotefile" cd="&remotedir." host="&host." 
    user="&username." pass="&password." port=21;    
data _null_;   
    %if %upcase(&ftptype)=PUT %then %do; 
        file rmfile; 
	    infile "&localdir./&localfile.";    
    %end; 
	%if %upcase(&ftptype)=GET %then %do; 
        infile rmfile; 
	    file "&localdir./&localfile.";    
    %end; 
	input;                                                      
	put _infile_;                                               
run;      
%mend;