<?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 files from FTP site to SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Download-files-from-FTP-site-to-SAS/m-p/355822#M83356</link>
    <description>oh I got It! datafile should be datafile=test. Thanks.</description>
    <pubDate>Thu, 04 May 2017 01:26:05 GMT</pubDate>
    <dc:creator>mlogan</dc:creator>
    <dc:date>2017-05-04T01:26:05Z</dc:date>
    <item>
      <title>Download files from FTP site to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-files-from-FTP-site-to-SAS/m-p/355076#M83153</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I am trying to copy files from the FTP server to SAS. Can someone please help. Folowing the are code that I wrote. Thanks.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FILENAME TEST FTP 'Test.xlsx' lrecl=256
                CD='/44434/Data/'
                HOST='files1.abc.com'
                USER='anonymous'
                PASS='XXXX';
				RUN;
PROC PRINT DATA=Test;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 May 2017 21:02:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-files-from-FTP-site-to-SAS/m-p/355076#M83153</guid>
      <dc:creator>mlogan</dc:creator>
      <dc:date>2017-05-01T21:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Download files from FTP site to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-files-from-FTP-site-to-SAS/m-p/355081#M83156</link>
      <description>&lt;P&gt;You need to create a datastep to input the file. For an example see:&amp;nbsp;&lt;A href="http://support.sas.com/kb/43/962.html" target="_blank"&gt;http://support.sas.com/kb/43/962.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2017 21:28:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-files-from-FTP-site-to-SAS/m-p/355081#M83156</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-05-01T21:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: Download files from FTP site to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-files-from-FTP-site-to-SAS/m-p/355115#M83172</link>
      <description>&lt;P&gt;You need 2 steps before your proc print.&lt;/P&gt;
&lt;P&gt;1- transfer the file to your machine, using the BINARY TRANSFER (read) logic in &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt; 's link&lt;/P&gt;
&lt;P&gt;2- proc import the transfered file into a SAS data set (or create a library with the xlsx engine)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2017 01:31:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-files-from-FTP-site-to-SAS/m-p/355115#M83172</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-05-02T01:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Download files from FTP site to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-files-from-FTP-site-to-SAS/m-p/355144#M83183</link>
      <description>&lt;P&gt;The filename statement only creates a reference to the external file, it does not do anything on its own.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print only works for SAS datasets, not for external files. So you need to import the data from the xlsx into a SAS dataset first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If have no idea if that could be possible in a single step. If it is possible at all, you need to define the file reference in a way that it works with the binary data of xlsx (xlsx is a zip archive of XML files; this means that the file itself is unstructured and must be handled as a stream).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you might try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename test ftp
  'Test.xlsx'
  cd='/44434/Data/'
  host='files1.abc.com'
  user='anonymous'
  pass='XXXX'
  recfm = s /* this is crucial */
;

proc import datafile=test dbms=xlsx out=work.test replace;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But I'd separate the steps first, as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt; suggested. You can even do a binary transfer in SAS alone, see &lt;A href="http://support.sas.com/kb/43/962.html" target="_blank"&gt;http://support.sas.com/kb/43/962.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2017 07:40:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-files-from-FTP-site-to-SAS/m-p/355144#M83183</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-05-02T07:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: Download files from FTP site to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-files-from-FTP-site-to-SAS/m-p/355820#M83354</link>
      <description>Hi KurtBremser, Thanks for the explanation. In the proc import stage I don't have my file in work library (you mentioned datafile=test). My data file is at ftp server. What would be the datafile location in my case would you please explain. Thanks.</description>
      <pubDate>Thu, 04 May 2017 01:23:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-files-from-FTP-site-to-SAS/m-p/355820#M83354</guid>
      <dc:creator>mlogan</dc:creator>
      <dc:date>2017-05-04T01:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: Download files from FTP site to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Download-files-from-FTP-site-to-SAS/m-p/355822#M83356</link>
      <description>oh I got It! datafile should be datafile=test. Thanks.</description>
      <pubDate>Thu, 04 May 2017 01:26:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Download-files-from-FTP-site-to-SAS/m-p/355822#M83356</guid>
      <dc:creator>mlogan</dc:creator>
      <dc:date>2017-05-04T01:26:05Z</dc:date>
    </item>
  </channel>
</rss>

