<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Download SAS Files from EG in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250289#M47185</link>
    <description>&lt;P&gt;Dear Duke,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you said, I added the binary option to the FTP filename for remfile, and it successfully downloaded the SAS data set with .sas7bdat extension. However, when I specified the libname statment to try to view the data, it returned an error "FIle XXXXXX is destroyed. I/O process is not complete". &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Feb 2016 12:07:24 GMT</pubDate>
    <dc:creator>Wang_Yajun</dc:creator>
    <dc:date>2016-02-16T12:07:24Z</dc:date>
    <item>
      <title>Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250067#M47117</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dear friends,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to download a SAS file with&lt;STRONG&gt; .sas7bdat&lt;/STRONG&gt; extension from EG Serve using the sample code below. While I successfully downloaded the file, but the file cannot be used. I suppose that &lt;STRONG&gt;the procecure to copy the files from EG&amp;nbsp;Serve may need to be modified&lt;/STRONG&gt;, so I am asking for your help. Thank you very much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;options mprint ;
%macro get_files ;
 
/* use filename FTP to obtain a list of the files in the remote directory */
 filename flist ftp ""
host='fs.tarp.com'
user="user"
pass="password"
ls
cd="remote/directory/path" ;
 
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")&amp;gt;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(&amp;amp;sqlobs) ; quit;
/* determine count of files */
%put Number of files to be copied:  &amp;amp;fcount ; options nonotes nomprint ;
 
/* loop through the file list */
%do j=1 %to &amp;amp;fcount ;
 
/* assign a FILENAME FTP for the remote file */ filename remfile ftp "&amp;amp;&amp;amp;fname&amp;amp;j"
host="fs.tarp.com"
user="user"
pass="password"
cd="remote/directory/path" ;
 
/*FILENAME for the local copy of the file */ filename flocal "local/directory/path/&amp;amp;&amp;amp;fname&amp;amp;j" ;
 
%put copying file &amp;amp;j ;
&lt;STRONG&gt;/* data step to copy the remote file */&lt;/STRONG&gt;
data _null_ ;
infile remfile ;
file flocal;
input ;
put _infile_ ;
run ;
%end ;
/* of loop */
options notes ;
%mend ;
%get_files ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 10:55:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250067#M47117</guid>
      <dc:creator>Wang_Yajun</dc:creator>
      <dc:date>2016-02-15T10:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250072#M47119</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not sure I follow you? &amp;nbsp;If they are datasets, then point a libname statement to the area where the datasets are located, a libname to where you want them to be and then datastep:&lt;/P&gt;
&lt;P&gt;data want.data;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set eg.data;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;For each of them. &amp;nbsp;I don't understand why you are FTP copying them?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 11:29:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250072#M47119</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-02-15T11:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250073#M47120</link>
      <description>"...it may need to be modified". Why don't you try first, it will just a guessing game for us.&lt;BR /&gt;&lt;BR /&gt;Perhaps off topic, but since the data is already in SAS format, isn't there another way to access it than using ftp? The name indicates it is a SAS server (perhaps EG stands for something else than enterprise guide). Either by a direct libref or using a workspace server.</description>
      <pubDate>Mon, 15 Feb 2016 11:33:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250073#M47120</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-02-15T11:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250078#M47123</link>
      <description>&lt;P&gt;What do you mean by "but the file cannot be used"?&lt;/P&gt;
&lt;P&gt;If you have a .sas7bdat file, which is a native SAS dataset, but no local SAS software (aside from EG), you have no tool to open the SAS file.&lt;/P&gt;
&lt;P&gt;If it is anything other, please provide the error message(s).&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 12:42:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250078#M47123</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-02-15T12:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250100#M47132</link>
      <description>&lt;P&gt;Since the data set I want to copy reside in the EG serve, not in the local place, so I have no way to directly copy the data set.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 14:41:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250100#M47132</guid>
      <dc:creator>Wang_Yajun</dc:creator>
      <dc:date>2016-02-15T14:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250102#M47133</link>
      <description>&lt;P&gt;Do you have access to the EG system (what is this EG Serve)? &amp;nbsp;If so, why can you not connect to the server via EG, point a libname to where you want the data locally, and then datastep as I mentioned. &amp;nbsp;Am not following what the problem is, you have:&lt;/P&gt;
&lt;P&gt;Source datasets - you should have access to these some how&lt;/P&gt;
&lt;P&gt;A destination, on your machine or network, by path.&lt;/P&gt;
&lt;P&gt;A method of moving the data, two libnames and a datastep.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 14:44:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250102#M47133</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-02-15T14:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250104#M47134</link>
      <description>&lt;P&gt;Dear Linush,&lt;/P&gt;&lt;P&gt;Thanks for your reply. To make it clear,EG stands for Enterprise Guide, and I want to download &amp;nbsp;SAS data sets from EG serve.&lt;/P&gt;&lt;P&gt;&amp;nbsp;Actually I tried to modify the coding, but I have no idea about how the final data step succeeds in copying the files, so I am here to ask for help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 14:47:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250104#M47134</guid>
      <dc:creator>Wang_Yajun</dc:creator>
      <dc:date>2016-02-15T14:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250106#M47135</link>
      <description>&lt;P&gt;Dear KurtBremser,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply. When I am downloading the SAS data set from the SAS EG Server into local PC, I use libname statement to read the SAS data set, and it appears a warning "&lt;STRONG&gt;This is not a SAS dataset, do you want to open another SAS dataset?&lt;/STRONG&gt;". Also, while I download the SAS dataset from EG server, I found that&lt;STRONG&gt; the dataset is surprising smaller than it should be&lt;/STRONG&gt;. Therefore, I suppose that the final data step needs to be modified, and I have no idea how to tackcle this problem. Thanks all the way for helping me.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 14:54:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250106#M47135</guid>
      <dc:creator>Wang_Yajun</dc:creator>
      <dc:date>2016-02-15T14:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250110#M47137</link>
      <description>&lt;P&gt;Dear RW9,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for reply, I will try your method. Actually I thought when I login into the serve, I cannot refer to the local path and remote path simulataneouly. Once it worked, I will let you know. Thanks again for your help.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 15:11:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250110#M47137</guid>
      <dc:creator>Wang_Yajun</dc:creator>
      <dc:date>2016-02-15T15:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250114#M47138</link>
      <description>&lt;P&gt;So if the resides on a SAS Server ("EG Serve"), why don't you use EG yourself? And why do you need to download&amp;nbsp;it?&lt;/P&gt;
&lt;P&gt;If yo still need to download&amp;nbsp;for some reason, there is functionality&amp;nbsp;within EG to do so.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 15:46:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250114#M47138</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-02-15T15:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250158#M47147</link>
      <description>&lt;P&gt;You can download a batch of files from EG using the Data-&amp;gt;Download SAS Data Sets task. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want even more flexibility, you can use the &lt;A href="http://blogs.sas.com/content/sasdummy/2012/12/06/copy-files-in-sas-eg/" target="_self"&gt;Copy Files custom task&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Both if these steps can be captured as steps within the SAS Enterprise Guide process flow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're looking to copy the files outside of an EG process, then you should probably use a shell script or FTP script.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 19:47:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250158#M47147</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2016-02-15T19:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250191#M47157</link>
      <description>&lt;P&gt;I assume that "EG Serve" is actually a SAS server running on a remote host.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To add to Chris' comment, there are two possibilities of problems with the code you first displayed.&lt;/P&gt;&lt;P&gt;1) you may need to add a 'binary' option to the FTP filename for "remfile".&amp;nbsp; Text is fine for getting the filenames, but not for the data.&lt;/P&gt;&lt;P&gt;2) do the local copies have th "sas7bdat" extension?&amp;nbsp; If not EG and SAS won't recognize them.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 21:21:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250191#M47157</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2016-02-15T21:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250215#M47163</link>
      <description>&lt;P&gt;&lt;SPAN class="login-bold"&gt;&lt;SPAN style="line-height: 20px;"&gt;Hello&lt;/SPAN&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;I know that in EG there is a point-click process to download the desired data, but now I want to use base SAS to automate this process. &amp;nbsp;The sample code I provided use FTP method to download the data/files, but&amp;nbsp;I found that even if I downloaded the data/files, and all the data/files has the right extension, but all the data/file size is 1kb, and cannot be opened locally. So I am asking for help to modify the coding.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2016 00:50:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250215#M47163</guid>
      <dc:creator>Wang_Yajun</dc:creator>
      <dc:date>2016-02-16T00:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250221#M47167</link>
      <description>Are you planning to use Base SAS to run and develop the code? Base interacts differently and you can see both your remote and local servers and move files between them with a bit more ease.</description>
      <pubDate>Tue, 16 Feb 2016 01:35:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250221#M47167</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-16T01:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250267#M47176</link>
      <description>&lt;P&gt;Your code uses the ftp method, but without a recfm= option, files are treated as text files, and the default lrecl is 254. Therefore mainly binary files will read a "record" until a linefeed character is encountered, and the data will be truncated to 254 bytes which are written out. Rinse and repeat.&lt;/P&gt;
&lt;P&gt;You may find that your files arrive as one 254 byte chunk.&lt;/P&gt;
&lt;P&gt;If you want to copy binary files, look into the recfm=n option.&lt;/P&gt;
&lt;P&gt;But why don't you use a standard ftp tool, which is much more suited to the job?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2016 09:25:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250267#M47176</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-02-16T09:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250289#M47185</link>
      <description>&lt;P&gt;Dear Duke,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you said, I added the binary option to the FTP filename for remfile, and it successfully downloaded the SAS data set with .sas7bdat extension. However, when I specified the libname statment to try to view the data, it returned an error "FIle XXXXXX is destroyed. I/O process is not complete". &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2016 12:07:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250289#M47185</guid>
      <dc:creator>Wang_Yajun</dc:creator>
      <dc:date>2016-02-16T12:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250290#M47186</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt; KurtBremser&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot for your helpful comment. Could you please show me the standard tool to download data from EG(Enterprise Guide) serve? &amp;nbsp;Thanks a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Yajun&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2016 12:08:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250290#M47186</guid>
      <dc:creator>Wang_Yajun</dc:creator>
      <dc:date>2016-02-16T12:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250300#M47189</link>
      <description>&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;For usage, on UNIX type &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;man ftp&lt;/FONT&gt;&lt;/STRONG&gt;, on Windows &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ftp /?&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2016 12:41:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250300#M47189</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-02-16T12:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250314#M47192</link>
      <description>&lt;P&gt;If you want to use a SAS program to drive the copy operation, &lt;A href="http://blogs.sas.com/content/sasdummy/2013/09/17/copy-file-macro/" target="_self"&gt;here's a technique you can try&lt;/A&gt;. &amp;nbsp;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).&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2016 13:26:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/250314#M47192</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2016-02-16T13:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Download SAS Files from EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/256684#M49211</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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")&amp;gt;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(&amp;amp;sqlobs) ; quit;
/* determine count of files */
%put Number of files to be copied:  &amp;amp;fcount ; /*options nonotes nomprint ;*/
 
/* loop through the file list */
%do j=1 %to &amp;amp;fcount ;
 
/* assign a FILENAME FTP for the remote file */ 
filename remfile ftp "&amp;amp;&amp;amp;fname&amp;amp;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\&amp;amp;&amp;amp;fname&amp;amp;j" recfm=n;
 
%put copying file &amp;amp;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 ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Mar 2016 03:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-SAS-Files-from-EG/m-p/256684#M49211</guid>
      <dc:creator>Wang_Yajun</dc:creator>
      <dc:date>2016-03-15T03:05:00Z</dc:date>
    </item>
  </channel>
</rss>

