<?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: FTP XLSX in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605848#M175850</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you sure that PROC EXPORT can even create an XLSX file using the FTP engine?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I guess so (will test it tomorrow). The file reference handles the transport, while proc export handles the conversion. For the file reference, it only receives a stream of data and puts it somewhere, while proc export creates that stream and does not worry what happens afterwards.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2019 17:34:59 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-11-20T17:34:59Z</dc:date>
    <item>
      <title>FTP XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605774#M175823</link>
      <description>&lt;P&gt;Hi. I want to ftp a a dataset in xlsx format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using the following code, but keep receiving error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;%let ftpUID=username;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;%let ftpPWD=password;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;%let outputFilename=file1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;filename datasetname&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;ftp cd= "file1"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;host="inserthost"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;user = "&amp;amp;ftpUID."&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;pass = "&amp;amp;ftpPWD."&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;dir&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;debug;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;data _null_;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;file dim_usr_ofc(&amp;amp;outputFilename..xlsx);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;termstr=crlf;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;ERROR: Invalid logical name.&lt;BR /&gt;ERROR: Error in the FILENAME statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice is appreciated. Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 15:18:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605774#M175823</guid>
      <dc:creator>SASUser_86</dc:creator>
      <dc:date>2019-11-20T15:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: FTP XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605778#M175825</link>
      <description>&lt;P&gt;For all I know,&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;STRONG&gt;datasetname&amp;nbsp;&lt;/STRONG&gt;is a fileref with more than 8 characters which does not conform to the rules of length of fileref. Is this something to do with the error stated?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 15:23:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605778#M175825</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-11-20T15:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: FTP XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605780#M175826</link>
      <description>Hi Novinosrin. Is the filename supposed to be the name of the sas dataset I want to export to the FTP server?&lt;BR /&gt;&lt;BR /&gt;Sorry, I am very new to SAS. I don't quite understand most of the terminologies.</description>
      <pubDate>Wed, 20 Nov 2019 15:25:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605780#M175826</guid>
      <dc:creator>SASUser_86</dc:creator>
      <dc:date>2019-11-20T15:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: FTP XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605787#M175828</link>
      <description>&lt;P&gt;File and library references must not be longer than 8 characters. That's still a hard limit in SAS.&lt;/P&gt;
&lt;P&gt;Change your local file reference to something shorter:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename dsname
  ftp
  cd= "file1"
  host="inserthost"
  user = "&amp;amp;ftpUID."
  pass = "&amp;amp;ftpPWD."
  dir
  debug
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Nov 2019 15:30:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605787#M175828</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-20T15:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: FTP XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605816#M175837</link>
      <description>Is the filename supposed to be the name of the sas dataset that I want to be moved in xlsx format to the ftp location? Thank you very much.</description>
      <pubDate>Wed, 20 Nov 2019 15:57:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605816#M175837</guid>
      <dc:creator>SASUser_86</dc:creator>
      <dc:date>2019-11-20T15:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: FTP XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605820#M175838</link>
      <description>&lt;P&gt;You use the FILENAME statement to create essentially an alias you want to use to reference a file.&amp;nbsp; We normally refer to this alias as the FILEREF.&amp;nbsp; That is what needs to be 8 characters or less.&amp;nbsp; It does not have to have anything to do with the name of the actual file you are referencing.&amp;nbsp; In your code you trying to use DATESETNAME as the fileref.&amp;nbsp; That is too long. Use something shorter.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 16:03:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605820#M175838</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-11-20T16:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: FTP XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605821#M175839</link>
      <description>&lt;P&gt;When you run the filename statement, you create a logical reference (for use only within SAS) that stands in for something more complicated (e.g. a ftp connection).&lt;/P&gt;
&lt;P&gt;So if you do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename out
  "myexcelfile.xlsx"
  ftp
  cd= "file1"
  host="inserthost"
  user = "&amp;amp;ftpUID."
  pass = "&amp;amp;ftpPWD."
  dir
  debug
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;SAS will set up the reference, but not yet really &lt;EM&gt;do&lt;/EM&gt; anything.&lt;/P&gt;
&lt;P&gt;Then, when you later use that reference:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export data=yourdata file=out dbms=xlsx;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;SAS will read the SAS dataset work.yourdata, convert it to the xlsx format, open a connection to inserthost, log on with the credentials supplied, do a change directory to directory file1, and create myexcelfile.xlsx there, with the converted dataset as contents.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that you cannot create an Excel file with a data step; only text files (e.g. .csv) can be written with a data step.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 16:08:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605821#M175839</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-20T16:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: FTP XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605835#M175842</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/182659"&gt;@SASUser_86&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Is the filename supposed to be the name of the sas dataset that I want to be moved in xlsx format to the ftp location? Thank you very much.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Maybe this will help a bit:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;File: the actual path and name on a hard drive. Example on Windows:&amp;nbsp;&amp;nbsp; C:\somefolder\otherfolder\thisfile.extention&lt;/P&gt;
&lt;P&gt;FILEREF: a short name, max 8 characters that allows you to reference that file with something like:&amp;nbsp; Myfile&lt;/P&gt;
&lt;P&gt;FILENAME&amp;nbsp; a statement in SAS that associates the Fileref with the File:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Filename Myfile "C:\somefolder\otherfolder\thisfile.extention" ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So in SAS procedures where you want to use the file you use the shorthand Fileref after the Filename statement does the association.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A Fileref could be used as a reference&amp;nbsp;for reading, writing or (&lt;STRONG&gt;very carefully&lt;/STRONG&gt;) both&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Generally you would not want a fileref for the SAS data set name. SAS keeps track of data sets in Librarys and the sets are referenced as LIBNAME.Dataset, with the WORK library the default if no explicit library is used.&amp;nbsp; Libraries are locations storing multiple items such as data sets and a LIBNAME statement creates a LIBREF, again 8 character limit, that points to the location.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 16:35:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605835#M175842</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-20T16:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: FTP XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605837#M175844</link>
      <description>&lt;P&gt;I used the code you provided. Based on your explanation I also realized that I misunderstood the cd portion of the code. I want to store the excel file in the root directory, so I made the change to "/". I have also include export data into my code. Please see errors below.&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;%let ftpUID=username;
%let ftpPWD=password;
%let outputFilename=file1;
filename out
  "myexcelfile.xlsx"
  ftp 
  cd= "/"
  host="hostname"
  user = "&amp;amp;ftpUID."
  pass = "&amp;amp;ftpPWD."
  dir
  debug
;

proc export data=mylib.test_bp file=out dbms=xlsx;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sas error.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34113i9D6E4BBAAC3DBEAE/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas error.png" alt="sas error.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 16:40:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605837#M175844</guid>
      <dc:creator>SASUser_86</dc:creator>
      <dc:date>2019-11-20T16:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: FTP XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605838#M175845</link>
      <description>&lt;P&gt;In a FILENAME statement the ENGINE (if specified) must appear immediately after the FILEREF.&lt;/P&gt;
&lt;PRE&gt;filename filef [engine]  .... ;&lt;/PRE&gt;
&lt;P&gt;In your case you want to use the FTP engine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you sure that PROC EXPORT can even create an XLSX file using the FTP engine?&amp;nbsp; You might have to create the XLSX file as a physical file on your SAS system first and then copy it to the FTP server.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 16:49:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605838#M175845</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-11-20T16:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: FTP XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605848#M175850</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you sure that PROC EXPORT can even create an XLSX file using the FTP engine?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I guess so (will test it tomorrow). The file reference handles the transport, while proc export handles the conversion. For the file reference, it only receives a stream of data and puts it somewhere, while proc export creates that stream and does not worry what happens afterwards.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 17:34:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FTP-XLSX/m-p/605848#M175850</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-20T17:34:59Z</dc:date>
    </item>
  </channel>
</rss>

