title: SAS PROC EXPORT and DBMS=CSV. ERROR: Export unsuccessful. See SAS Log for details
body: <p>I want to export multiple SAS datasets as CSV files (not as xlsx files) using SAS 9.4. When using the code for any of the datasets:</p>
  <pre><code>proc export data = dataset
      outfile = &quot;C:\MBorg\dataset.csv&quot;
      dbms = csv replace;
  run;
  </code></pre>
  <p>I receive this error message:</p>
  <pre><code>ERROR: Export unsuccessful.  See SAS Log for details.
  NOTE: The SAS System stopped processing this step because of errors.
  NOTE: PROCEDURE EXPORT used (Total process time):
        real time           0.06 seconds
        cpu time            0.01 seconds
  </code></pre>
  <p>Contrary to what the error message suggests, the SAS log provides no extra details.</p>
  <p>Folder permissions or having Excel closed or open when running the code as per <a href="https://stackoverflow.com/questions/58909548/sas-proc-export-errors">this question's answer</a>, or using an empty dataset, makes no difference. The <a href="https://support.sas.com/kb/62/386.html" rel="nofollow noreferrer">SAS website</a> mentions that this error can occur when using PROC EXPORT with DBMS=CSV, and it can be avoided by using name-literal syntax. However, using it as per below makes no difference.</p>
  <pre><code>proc export data = work.'dataset'n
      outfile = &quot;C:\MBorg\dataset.csv&quot;
      dbms = csv replace;
  run;
  </code></pre>
  <p>Strangely the only way I can find to circumvent the problem is resetting SAS. <code>options obs=max</code> makes no difference. Not sure what causes this message. This occurred with SAS 9.4 M0 and M7.</p>
  <p>Any help with exporting CSV files without resetting SAS would be helpful.</p>