<?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: export large dataset to multiple csv files in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116614#M24059</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi: Rather than tinkering with PROC EXPORT, I would use the NEWFILE=BYGROUP with ODS CSV. There's a code example below. In the first example, a simple BY AGE was used in PROC PRINT to create a separate output file for each age. In the second example, I used a DATA step program to make some groups using IF logic, then I use the new group variable in my BY statement. In the second example, you should get 3 output files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc sort data=sashelp.class;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;by age;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title; footnote;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;** 1) will get 1 csv file for each age;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods csv file='c:\temp\age11.csv' &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; newfile=bygroup;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc print data=sashelp.class;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by age;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods csv close;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;** 2) use my logic to make groups;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;data newfile;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;** create new groups using logic;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; set sashelp.class;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; if age in (11,12) then&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mygrp = 1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; else if age in (13, 14) then&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mygrp = 2;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; else mygrp = 3;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc sort data=newfile;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; by mygrp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;** will make mgrp1, mgrp2, mgrp3 files;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods csv file='c:\temp\mgrp1.csv' &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; newfile=bygroup;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc print data=newfile;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by mygrp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods csv close;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Oct 2013 17:52:42 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2013-10-18T17:52:42Z</dc:date>
    <item>
      <title>export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116612#M24057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to export a very large dataset to csv, but I need to break the output into multiple, smaller files for the downstream process.&amp;nbsp; The split need to incorporate logic so that certain groups of records are not split across files.&amp;nbsp; Can anyone suggest ways to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My current plan: look at what proc export sticks in the log (it seems to be a macro, despite the name), scrape that code and doctor it do the split logic.&amp;nbsp; I'm pretty sure this will work (I haven't seen the spec for the logic yet), but there may be a less hacky way.&amp;nbsp; If so, RSVP.export&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Oct 2013 17:19:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116612#M24057</guid>
      <dc:creator>jdmarino</dc:creator>
      <dc:date>2013-10-18T17:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116613#M24058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The support.sas.com site has several macros that will split files by groups.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/kb/38/430.html" title="http://support.sas.com/kb/38/430.html"&gt;38430 - Exporting BY groups from a SAS data set to multiple Microsoft Excel or text files&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know if you have a true "BY" group though without more details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this code can also be modified to export to CSV simply enough:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sascommunity.org/wiki/Split_Data_into_Subsets" title="http://www.sascommunity.org/wiki/Split_Data_into_Subsets"&gt;Split Data into Subsets - sasCommunity&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Oct 2013 17:44:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116613#M24058</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-10-18T17:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116614#M24059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi: Rather than tinkering with PROC EXPORT, I would use the NEWFILE=BYGROUP with ODS CSV. There's a code example below. In the first example, a simple BY AGE was used in PROC PRINT to create a separate output file for each age. In the second example, I used a DATA step program to make some groups using IF logic, then I use the new group variable in my BY statement. In the second example, you should get 3 output files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc sort data=sashelp.class;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;by age;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title; footnote;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;** 1) will get 1 csv file for each age;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods csv file='c:\temp\age11.csv' &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; newfile=bygroup;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc print data=sashelp.class;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by age;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods csv close;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;** 2) use my logic to make groups;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;data newfile;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;** create new groups using logic;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; set sashelp.class;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; if age in (11,12) then&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mygrp = 1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; else if age in (13, 14) then&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mygrp = 2;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; else mygrp = 3;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc sort data=newfile;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; by mygrp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;** will make mgrp1, mgrp2, mgrp3 files;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods csv file='c:\temp\mgrp1.csv' &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; newfile=bygroup;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc print data=newfile;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by mygrp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods csv close;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Oct 2013 17:52:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116614#M24059</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2013-10-18T17:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116615#M24060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;CSV files are trivial to write with a SAS datastep.&amp;nbsp; If you ignore the header record you just need:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set MYDATA ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; file MYFILE dsd dlm=',' lrecl=32000 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; put (_all_) (:) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To make multiple files you can use the FILEVAR option on the FILE statement to control the name of the target file with data step logic.&lt;/P&gt;&lt;P&gt;You can build macro variables with the list of variable names from the metadata (SASHELP.VCOLUMN or use PROC CONTENTS) to drive the put statement.&amp;nbsp; You can also build a macro variable with valid code to put the variable names (or labels) as the header.&lt;/P&gt;&lt;P&gt;You can use a double DOW loop to count how many records you have per by group before you start the group so that you can decide if you should start a new file before the current BY value.&lt;/P&gt;&lt;P&gt;So something like this: (UNTESTED)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let varlist=A B C;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let titles="A" ',' "B" ',' "C" ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let maxobs=10000 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; do nobs=1 by 1 until (last.group);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set mydata ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by group ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; do until (last.group) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set mydata ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by group ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if nrecs=0 or (nrecs + nobs &amp;gt; &amp;amp;maxobs) then do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filenumber+1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrecs=0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filename = cats('myfile',filenumber,'.csv');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file dummy filevar=filename dsd dlm=',' lrecl=32000 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrecs+1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if nrecs=1 then put &amp;amp;titles;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put &amp;amp;varlist ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Oct 2013 18:19:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116615#M24060</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-10-18T18:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116616#M24061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've never used ODS, and this seems like the newthink.&amp;nbsp; When I learn more about the split logic, I'll give this a try.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Oct 2013 18:26:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116616#M24061</guid>
      <dc:creator>jdmarino</dc:creator>
      <dc:date>2013-10-18T18:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116617#M24062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This blows my mind.&amp;nbsp; I don't know how to think about iterating over set and by statements.&amp;nbsp; Are you looping over the input multiple times?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Oct 2013 18:32:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116617#M24062</guid>
      <dc:creator>jdmarino</dc:creator>
      <dc:date>2013-10-18T18:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116618#M24063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I do a lot of macro programming, so this approach is, at least, familiar territory.&amp;nbsp; I think I'm going to try the ODS solution, but I worry that I will have mygrp in the output (and it wasn't in the original input).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Oct 2013 18:34:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116618#M24063</guid>
      <dc:creator>jdmarino</dc:creator>
      <dc:date>2013-10-18T18:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116619#M24064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is reading the input dataset twice. But it does it in one pass with two separate pointers (one for each SET statement).&amp;nbsp; Unless your BY groups have a lot of records disk cache or operating system buffering will make it use the same number of physical disk reads as a single pass.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Oct 2013 18:38:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116619#M24064</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-10-18T18:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116620#M24065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Without a VAR statement all variables except the ones listed in the BY statement will appear.&lt;/P&gt;&lt;P&gt;Use OPTIONS NOBYLINE to suppress any BY line that PROC PRINT might generate.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Oct 2013 18:41:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116620#M24065</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-10-18T18:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116621#M24066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've never done this.&amp;nbsp; I've always used drop= or keep= on the input dataset to get the columns I want.&amp;nbsp; (Any way, I will have to enumerate the columns I want, which means being aware of them.&amp;nbsp; It would be nice to avoid that: drop= would only need to know about the columns I create.&amp;nbsp; But I can't BY process on a dropped column.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's always good to post here and get help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Oct 2013 18:47:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116621#M24066</guid>
      <dc:creator>jdmarino</dc:creator>
      <dc:date>2013-10-18T18:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116622#M24067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;If you split the data in logical way so that it won't misinterpreat any values, it will be tedious task as in a big data user can't easily make the group based on values...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;So my try is to use the attached SAS Macro which creates the one CSV file with a different sheets correspond to each unique values of the variable...It will work for any variable (Charcter or Numeric)...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;If this one is not meeting requirement, please let us know the approx observation so that we can think about new logic...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;-Urvish&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 09:00:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116622#M24067</guid>
      <dc:creator>UrvishShah</dc:creator>
      <dc:date>2013-10-21T09:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116623#M24068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Urvish; it's generous of you to share.&amp;nbsp; I don't yet know the split logic (I'm helping a friend and he hasn't yet provided me the spec).&amp;nbsp; But more importantly, I'm &lt;EM&gt;not&lt;/EM&gt; exporting to excel files, but to actual .CSVs, thus the multisheet approach does not apply.&amp;nbsp; (A .csv is a pure text file; there are no sheets.)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 12:43:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116623#M24068</guid>
      <dc:creator>jdmarino</dc:creator>
      <dc:date>2013-10-21T12:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116624#M24069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Cynthia,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying your solution because it seems require the least coding on my part.&amp;nbsp; I have to say, however, that ODS is a multi-headed monster, and I can't find anything in the help about "ods csv".&amp;nbsp; (I can find "ods csvall", but that's a different beast.)&amp;nbsp; Can you point me to some documentation?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second question: I'd like NULLs in my dataset to be represented by consecutive delimiters (i.e. an empty field), but I'm getting a '.' (missing).&amp;nbsp; Can you tell me how to turn off the dot?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 16:47:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116624#M24069</guid>
      <dc:creator>jdmarino</dc:creator>
      <dc:date>2013-10-28T16:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116625#M24070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One way regarding how to "turn off" the dots:&lt;/P&gt;&lt;P&gt;options missing=' ';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some documentation: I got a number of related hits doing a Google search on:&lt;/P&gt;&lt;P&gt;ods csv sas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 17:06:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116625#M24070</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-10-28T17:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116626#M24071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to write a general purpose macro (although that's a secondary priority),so I'd certainly prefer to only turn off the dots for the proc print and not in general.&amp;nbsp; Maybe I can detect the state of that option and restore it after I do my work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let missopt = %sysfunc(getoption(missing,keyword)); /* store the existing option away */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; options missing='';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; options &amp;amp;missopt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;This seems to be what I wanted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interesting about the google search; I've been searching both my local help file and support.sas.com and not getting good results.&amp;nbsp; (I get results, just not relevant one.)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 17:13:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116626#M24071</guid>
      <dc:creator>jdmarino</dc:creator>
      <dc:date>2013-10-28T17:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116627#M24072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, I was disappointed today.&amp;nbsp; I tested my code on a 100K row dataset, splitting into 10k chunks but not splitting across a special set of vars.&amp;nbsp; It worked.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BUT, when I ran it on the real 47M row dataset, I got &lt;/P&gt;&lt;P&gt;ERROR: The SAS System stopped processing this step because of insufficient memory.&lt;/P&gt;&lt;P&gt;on a machine with 24Gig of RAM and a Terabyte of drive space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, to try Tom's approach.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 21:24:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116627#M24072</guid>
      <dc:creator>jdmarino</dc:creator>
      <dc:date>2013-10-28T21:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116628#M24073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just out of curiosity I have two questions: (1) Did you sort your real dataset before running the code? AND (2)does your work directory happen to be on a drive that has very limited memory?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 21:31:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116628#M24073</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-10-28T21:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116629#M24074</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ods csv involves far mode than you need&lt;/P&gt;&lt;P&gt;Other ODS destinations take better advantage of the overheads of the destination approach.&lt;/P&gt;&lt;P&gt;To generate a csv file requires very little memory&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 23:20:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116629#M24074</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2013-10-28T23:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116630#M24075</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it is worth getting over the apparent complexity (of Tom's method), when you have 47M rows that cause a lot of difficulty for the apparently "simpler" ODS approach&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 23:22:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116630#M24075</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2013-10-28T23:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: export large dataset to multiple csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116631#M24076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got the basics working (had problems when the BY group was larger than the row threshold for a file).&amp;nbsp; I'm about to research dataset introspection so I can build a list of the fields to output.&amp;nbsp; _all_ is no good for me because of the extra fields I added.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Oct 2013 17:52:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/export-large-dataset-to-multiple-csv-files/m-p/116631#M24076</guid>
      <dc:creator>jdmarino</dc:creator>
      <dc:date>2013-10-30T17:52:33Z</dc:date>
    </item>
  </channel>
</rss>

