Hi, KurtBremser
Thanks a lot for your helpful comment. Could you please show me the standard tool to download data from EG(Enterprise Guide) serve? Thanks a lot.
Best regards,
Yajun
It's the original "ftp" utility, present on all platforms. Just call it with the X statement or call system subroutine. Usage depends on the operating system.
For usage, on UNIX type man ftp, on Windows ftp /?
If you want to use a SAS program to drive the copy operation, here's a technique you can try. Two approaches: the DATA step to copy binary files, even from an FTP location, and then also the FCOPY function that might help (SAS 9.4).
Hello,
I'm sorry for late reply, as I am asking the SAS Technical support for help. The final solution to download files from EG serve is in the following SAS code.
options mprint mlogic ;
%macro get_files ;
/* use filename FTP to obtain a list of the files in the remote directory */
filename flist ftp ""
host='172.26.38.38'
user="sasdemo"
pass="Sas123"
ls
cd="\t1" ;
data remlist ;
length fname $100 ;
infile flist truncover ;
input fname $100. ;
/* Specifiy a pattern match here to subset the remote files that are to be moved */
/*if index(fname,"Test")>0 then output ; */
run ;
/* create a list of macro variables holding the remote file names */
proc sql noprint ; select fname into :fname1-:fname32000 from remlist ; %let fcount=%eval(&sqlobs) ; quit;
/* determine count of files */
%put Number of files to be copied: &fcount ; /*options nonotes nomprint ;*/
/* loop through the file list */
%do j=1 %to &fcount ;
/* assign a FILENAME FTP for the remote file */
filename remfile ftp "&&fname&j"
host="172.26.38.38"
user="sasdemo"
pass="Sas123"
cd="/t1" recfm=f debug;
/*FILENAME for the local copy of the file */
filename flocal "C:\temp\download\&&fname&j" recfm=n;
%put copying file &j ;
/* data step to copy the remote file */
data _null_ ;
N=1;
infile remfile NBYTE=n;
file flocal;
input ;
put _infile_ @@;
run ;
%end ;
/* of loop */
options notes ;
%mend ;
%get_files ;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: