Get File List and Load File Using FTP in SAS

/**
* Obtain the listing of files in the specified directory using FTP connection.
*/
%macro getFileListing(sourceDir=);

filename dataSrc ftp "" ls user="usename" pass="password" cd="&sourceDir."
host="192.168.245.1";

data Files;
infile dataSrc truncover dsd;
input fileName $255. ;
run;

filename dataSr clear;

%mend getFileListing;

/**
* Load a file using FTP connection. Specify the path on the FTP server and the file name.
*/
%macro loadFile(filePath=, fileName=);

filename iFile ftp "&fileName." user="usename" pass="password" cd="&filePath."
host='192.168.245.1';

data File;
infile iFile;
input contents $3200.;
run;

filename iFile clear;

%mend loadFile;

%getFileListing(sourceDir=/test/user/directory);
%loadFile(filePath=/test/user/directory, fileName=test.txt);