<?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: Best / Fastest way to create a CSV from a dataset? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Best-Fastest-way-to-create-a-CSV-from-a-dataset/m-p/413002#M279917</link>
    <description>&lt;P&gt;Proc export data=combined&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile="DISP_PRE1882.csv"&amp;nbsp;&amp;nbsp; /* second = character removed*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbms=CSV&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; replace&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want the variable labels instead of the names add LABEL before the&amp;nbsp; ; on the proc statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do recommend always using a fully qualified path instead of just the out&amp;nbsp;file name as the folder it ends up in may be problematic for some uses.&lt;/P&gt;</description>
    <pubDate>Mon, 13 Nov 2017 21:17:17 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-11-13T21:17:17Z</dc:date>
    <item>
      <title>Best / Fastest way to create a CSV from a dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-Fastest-way-to-create-a-CSV-from-a-dataset/m-p/412999#M279916</link>
      <description>&lt;P&gt;Currently I am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ODS CSV FILE="DISP_PRE1882.csv" TYPE=csvall PATH="/home/xxxx";&lt;/P&gt;&lt;P&gt;PROC PRINT DATA=COMBINED3;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;ODS CSV close;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;wondering if there is a faster way to do this? The Dataset has amost 1 million rows and it can take a while...&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;&lt;P&gt;-Geoff&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 18:15:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-Fastest-way-to-create-a-CSV-from-a-dataset/m-p/412999#M279916</guid>
      <dc:creator>StaticFX</dc:creator>
      <dc:date>2017-11-13T18:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Best / Fastest way to create a CSV from a dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-Fastest-way-to-create-a-CSV-from-a-dataset/m-p/413002#M279917</link>
      <description>&lt;P&gt;Proc export data=combined&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile="DISP_PRE1882.csv"&amp;nbsp;&amp;nbsp; /* second = character removed*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbms=CSV&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; replace&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want the variable labels instead of the names add LABEL before the&amp;nbsp; ; on the proc statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do recommend always using a fully qualified path instead of just the out&amp;nbsp;file name as the folder it ends up in may be problematic for some uses.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 21:17:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-Fastest-way-to-create-a-CSV-from-a-dataset/m-p/413002#M279917</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-11-13T21:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: Best / Fastest way to create a CSV from a dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-Fastest-way-to-create-a-CSV-from-a-dataset/m-p/413004#M279918</link>
      <description>&lt;P&gt;Ok, so I add the full path in the outfile?&amp;nbsp;&lt;/P&gt;&lt;P&gt;and why is there 2 ==?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 18:25:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-Fastest-way-to-create-a-CSV-from-a-dataset/m-p/413004#M279918</guid>
      <dc:creator>StaticFX</dc:creator>
      <dc:date>2017-11-13T18:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Best / Fastest way to create a CSV from a dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-Fastest-way-to-create-a-CSV-from-a-dataset/m-p/413044#M279919</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/173987"&gt;@StaticFX&lt;/a&gt;&amp;nbsp;its a typo, a single = is fine.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 20:36:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-Fastest-way-to-create-a-CSV-from-a-dataset/m-p/413044#M279919</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-13T20:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: Best / Fastest way to create a CSV from a dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-Fastest-way-to-create-a-CSV-from-a-dataset/m-p/413049#M279920</link>
      <description>&lt;P&gt;Just use a data step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_ ;
  file "/home/xxxx/DISP_PRE1882.csv" dsd ;
  set COMBINED3;
  put (_all_) (+0);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you need to add a header row you can generate that first and then use the MOD option on the FILE statement in the data step above.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=COMBINED3(obs=0) out=names;
  var _all_;
run;
data _null_ ;
  file "/home/xxxx/DISP_PRE1882.csv" dsd ;
  set names end=eof;
  put _name_ @ ;
  if eof then put;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 20:55:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-Fastest-way-to-create-a-CSV-from-a-dataset/m-p/413049#M279920</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-11-13T20:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: Best / Fastest way to create a CSV from a dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-Fastest-way-to-create-a-CSV-from-a-dataset/m-p/413305#M279921</link>
      <description>Or Check MACRO
%ds2csv()</description>
      <pubDate>Tue, 14 Nov 2017 12:56:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-Fastest-way-to-create-a-CSV-from-a-dataset/m-p/413305#M279921</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-11-14T12:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: Best / Fastest way to create a CSV from a dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-Fastest-way-to-create-a-CSV-from-a-dataset/m-p/413343#M279922</link>
      <description>&lt;P&gt;Good lord its like night and day! this took 11.9 seconds to write 1.02m records to the file! Plus it was 27mb smaller... Thanks so much!&lt;/P&gt;&lt;P&gt;I havent tried the others to compare, but no need now lol&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 14:45:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-Fastest-way-to-create-a-CSV-from-a-dataset/m-p/413343#M279922</guid>
      <dc:creator>StaticFX</dc:creator>
      <dc:date>2017-11-14T14:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: Best / Fastest way to create a CSV from a dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-Fastest-way-to-create-a-CSV-from-a-dataset/m-p/413350#M279923</link>
      <description>&lt;P&gt;You also might try writing directly to a compressed file and see if that makes it faster.&amp;nbsp; The computer will probably spend more CPU cycles compressing the file, but much less time will be spend waiting for the data to be written to the disk.&lt;/P&gt;
&lt;P&gt;You could use the ZIP filename engine. And if you have at least SAS 9.4 M5 release you can use GZIP format which should be a little faster as it does not have the overhead of multiple file archives like ZIP format.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path=%sysfunc(pathname(work));

filename csv "&amp;amp;path/class.txt";
proc export data=sashelp.class file=csv dbms=csv ; run;

filename csvgz zip "&amp;amp;path/class.txt.gz" gzip ;
proc export data=sashelp.class file=csvgz dbms=csv ; run;

filename csvzip zip "&amp;amp;path/class.zip" member='class.txt' ;
proc export data=sashelp.class file=csvzip dbms=csv ; run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Nov 2017 15:01:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-Fastest-way-to-create-a-CSV-from-a-dataset/m-p/413350#M279923</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-11-14T15:01:29Z</dc:date>
    </item>
  </channel>
</rss>

