<?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: Upload SAS Dataset from SAS to FTP as csv in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227097#M40888</link>
    <description>&lt;P&gt;Did you have a version of this code run that was not in a macro? That is the first step.&lt;/P&gt;&lt;P&gt;Did you run the code with option MPRINT so you can see what the macro is generating?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And just a suspicion, you have User="&amp;amp;usuer.".&amp;nbsp; Could that macro variable be misspelled?&lt;/P&gt;&lt;P&gt;And since you did not pass several of the macro variables as parameters you could be running into a scope issue.&lt;/P&gt;</description>
    <pubDate>Thu, 24 Sep 2015 15:25:36 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2015-09-24T15:25:36Z</dc:date>
    <item>
      <title>Upload SAS Dataset from SAS to FTP as csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227077#M40887</link>
      <description>&lt;P&gt;I'm completely new to FTP. &amp;nbsp;I'm trying my best to figure this out on my own, but I'm having no luck.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created a SAS dataset that I want to export into a pipe-delimited ("|") csv file and upload that file to an FTP site. &amp;nbsp;I came across a code snippet that&amp;nbsp;apparently shows how to do just that, but I can't seem to figure it out. &amp;nbsp;Here is the snippet:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%macro export_to_ftp(dsn=, outfile_name=);
	FILENAME MyFTP ftp "&amp;amp;outfile_name." 
		HOST="&amp;amp;host."
		USER="&amp;amp;usuer."
		PASS="&amp;amp;passwrd.";

	PROC EXPORT DATA=&amp;amp;dsn. OUTFILE=MyFTP DBMS=%SCAN(&amp;amp;outfile_name.,2,.) REPLACE;
		delimiter='|';
	RUN;
	filename MyFTP clear;
%mend;

%export_to_ftp(dsn=sashelp.class, outfile_name=CLASS.csv);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Every time I run this, I get&amp;nbsp;the message: &amp;nbsp;"ERROR: Open failed for file MYFTP." &amp;nbsp;That is immediately followed by another error that the connection has timed out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone explain the components of the FILENAME statement to me? &amp;nbsp;I wonder if I'm missing something. &amp;nbsp;I know there is a CD= option, but I wasn't sure if that was the directory for where the file should be saved on the FTP site. &amp;nbsp;I have played around with it, but I still get the same errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In addition to uploading a file, is it possible to create a folder on an FTP site with SAS code? &amp;nbsp;Similar to the DCREATE() function?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 14:48:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227077#M40887</guid>
      <dc:creator>djbateman</dc:creator>
      <dc:date>2015-09-24T14:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: Upload SAS Dataset from SAS to FTP as csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227097#M40888</link>
      <description>&lt;P&gt;Did you have a version of this code run that was not in a macro? That is the first step.&lt;/P&gt;&lt;P&gt;Did you run the code with option MPRINT so you can see what the macro is generating?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And just a suspicion, you have User="&amp;amp;usuer.".&amp;nbsp; Could that macro variable be misspelled?&lt;/P&gt;&lt;P&gt;And since you did not pass several of the macro variables as parameters you could be running into a scope issue.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 15:25:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227097#M40888</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-09-24T15:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: Upload SAS Dataset from SAS to FTP as csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227147#M40892</link>
      <description>&lt;P&gt;It's not a macro issue. &amp;nbsp;The variables not passed through (like host, password, or user) were just place holders to mask my information. &amp;nbsp;I did run run it outside of the macro, and it didn't help any.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 18:10:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227147#M40892</guid>
      <dc:creator>djbateman</dc:creator>
      <dc:date>2015-09-24T18:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: Upload SAS Dataset from SAS to FTP as csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227174#M40897</link>
      <description>&lt;P&gt;Try running the code without the macros and post the entire log. Change any sensitive values to XXXX or similar.&lt;/P&gt;&lt;P&gt;But there was an awful lot of macro code, such as the functions and such, that sure looked like this macro&amp;nbsp;was written to do something and not demostrate a problem.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 19:45:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227174#M40897</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-09-24T19:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: Upload SAS Dataset from SAS to FTP as csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227250#M40917</link>
      <description>&lt;P&gt;The SAS log is attached. &amp;nbsp;I'm still getting the same errors even when I take out the macros.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for taking your time to keep dealing with this. &amp;nbsp;I hope we can resolve this soon.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 12:11:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227250#M40917</guid>
      <dc:creator>djbateman</dc:creator>
      <dc:date>2015-09-25T12:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Upload SAS Dataset from SAS to FTP as csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227309#M40945</link>
      <description>&lt;P&gt;The error is from the filename statement, there is an issue with the FTP.&lt;/P&gt;&lt;P&gt;If you are running SAS 9.2 TS1M0 there is an issue:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/kb/34098" target="_blank"&gt;http://support.sas.com/kb/34098&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 17:24:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227309#M40945</guid>
      <dc:creator>michelle_delaurentis_sas_com</dc:creator>
      <dc:date>2015-09-25T17:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Upload SAS Dataset from SAS to FTP as csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227310#M40946</link>
      <description>&lt;P&gt;I'm running SAS 9.3, and I'm even upgrading to SAS 9.4 hopefully by the end of the month. &amp;nbsp;Maybe that will make a difference?&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 17:26:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227310#M40946</guid>
      <dc:creator>djbateman</dc:creator>
      <dc:date>2015-09-25T17:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Upload SAS Dataset from SAS to FTP as csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227311#M40947</link>
      <description>&lt;P&gt;If you manually login to the server can you then manually upload a file? You may not have privileges to write data to that location and need to provide a path to&amp;nbsp;a directory on the server that allows writing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am assuming that the quotes got lost on the PASS option when anonymized for posting here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 17:29:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227311#M40947</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-09-25T17:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: Upload SAS Dataset from SAS to FTP as csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227312#M40948</link>
      <description>&lt;P&gt;Yes, I can manually upload files. &amp;nbsp;That's what I have been doing. &amp;nbsp;But they want me to start updating our reports daily, and I was hoping to be able to automate this so I don't have to login and transfer manually every morning.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And yes, the quotes must have been removed&amp;nbsp;when anonymizing the output. My code has the quotes in there.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 17:33:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227312#M40948</guid>
      <dc:creator>djbateman</dc:creator>
      <dc:date>2015-09-25T17:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Upload SAS Dataset from SAS to FTP as csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227314#M40949</link>
      <description>I didn't think about me not having the proper privileges to write to my location. I can look into that and see if that's the issue.</description>
      <pubDate>Fri, 25 Sep 2015 17:34:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Upload-SAS-Dataset-from-SAS-to-FTP-as-csv/m-p/227314#M40949</guid>
      <dc:creator>djbateman</dc:creator>
      <dc:date>2015-09-25T17:34:09Z</dc:date>
    </item>
  </channel>
</rss>

