title: Exporting SAS Data into FTP using SAS
body: <p>I wanted to export SAS dataset from SAS into FTP. I can export csv file (or txt file) using the following command:</p>
  
  <pre><code>%macro export_to_ftp(dsn= ,outfile_name= );
  
  Filename MyFTP ftp "&amp;outfile_name." 
  HOST='ftp.site.com'
                   cd= "&amp;DATA_STRM/QC" 
                    USER=&amp;ftp_user.
                    PASS=&amp;ftp_pass.;
  
  PROC EXPORT DATA= &amp;dsn. OUTFILE= MyFTP DBMS=%SCAN(&amp;outfile_name.,2,.) REPLACE; 
  RUN; filename MyFTP clear;
  %mend;
  
  %export_to_ftp(dsn=lib1.dataset ,outfile_name=dataset.csv);
  </code></pre>
  
  <p>But couldn't use it to export SAS dataset. Can anybody please help me.</p>
  
  <p>Thank you!</p>