<?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 big sas data set into csv or txt in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894256#M353254</link>
    <description>&lt;P&gt;With ODS, to prevent writing to additional output destinations, use:&lt;/P&gt;
&lt;P&gt;ods _all_ close;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Sep 2023 12:57:06 GMT</pubDate>
    <dc:creator>Kathryn_SAS</dc:creator>
    <dc:date>2023-09-14T12:57:06Z</dc:date>
    <item>
      <title>Export big sas data set into csv or txt</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894245#M353246</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;Here are 4 ways to export SAS data set into CSV&amp;nbsp; or TXT file.&lt;/P&gt;
&lt;P&gt;Let's say that the sas data set has 250 million rows with 30 columns.&lt;/P&gt;
&lt;P&gt;I have some questions please:&lt;/P&gt;
&lt;P&gt;1-Which way from the 4 ways is the recommended way to do the export?&lt;/P&gt;
&lt;P&gt;2- Do you recommend export it into CSV or TXT file?&lt;/P&gt;
&lt;P&gt;3- About Way1- If the data set is very big then it is better not print it into the screen.&lt;/P&gt;
&lt;P&gt;I added code -ods select none;&amp;nbsp; &amp;nbsp; but then I got 0 rows in the resulted file.&lt;/P&gt;
&lt;P&gt;What is the way to create the&amp;nbsp; file using ODS CSV but prevent print on screen?&lt;/P&gt;
&lt;P&gt;4-About way4- what is the name of this way?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
/*Way1----Exporting sas dataset using ods*/
ods csv file='/usr/local/SAS/SASUsers/LabRet/Adhoc/Example1.txt' options(delimiter='|');
proc print data=sashelp.cars noobs;
run;
ods csv close;


/*Way2---Exporting sas dataset using proc export into CSV file*/
proc export data=sashelp.cars
outfile='/usr/local/SAS/SASUsers/LabRet/Adhoc/Example2.csv'
dbms=csv
replace;
run;


/*Way3---Exporting sas dataset using proc export into delimited file*/
proc export data=sashelp.cars
outfile='/usr/local/SAS/SASUsers/LabRet/Adhoc/Example3.csv'
dbms=dlm
replace;
delimiter='|';
run;


/***Way4---***/
%macro export_flat_files;
%let file_extract='/usr/local/SAS/SASUsers/LabRet/Adhoc/Example4.txt';
%put &amp;amp;file_extract;
data _null_;
file &amp;amp;file_extract dsd dlm ='|';
set sashelp.cars;
put (_all_) (~);
run;
%mend;
%export_flat_files;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 10:49:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894245#M353246</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2023-09-14T10:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Export big sas data set into csv or txt</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894248#M353247</link>
      <description>&lt;P&gt;The main difference between CSV and TXT is the default app trying to display the file. The delimiter can be the same in both file types.&lt;/P&gt;
&lt;P&gt;I would choose the 4th way, because it has least overhead.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 11:12:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894248#M353247</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2023-09-14T11:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Export big sas data set into csv or txt</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894252#M353251</link>
      <description>What do you mean " least overhead"?&lt;BR /&gt;Is way 4 called data set method?&lt;BR /&gt;Do you prefer exoprt to csv or txt( 200 million rows)</description>
      <pubDate>Thu, 14 Sep 2023 12:16:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894252#M353251</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2023-09-14T12:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Export big sas data set into csv or txt</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894255#M353253</link>
      <description>&lt;P&gt;I never had to export such a large volume, but i would use txt, to prevent the file being opened by excel accidentally.&lt;/P&gt;
&lt;P&gt;Least overhead: the data step only does what you tell it to do. proc export has always some additional stuff, so has ods - i suspect.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 12:43:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894255#M353253</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2023-09-14T12:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Export big sas data set into csv or txt</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894256#M353254</link>
      <description>&lt;P&gt;With ODS, to prevent writing to additional output destinations, use:&lt;/P&gt;
&lt;P&gt;ods _all_ close;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 12:57:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894256#M353254</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2023-09-14T12:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Export big sas data set into csv or txt</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894262#M353257</link>
      <description>&lt;P&gt;ODS is the worst way, it performs like wading through molasses.&lt;/P&gt;
&lt;P&gt;If you use #4, you must add code to write the headerline, if such is required.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 13:46:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894262#M353257</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-09-14T13:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: Export big sas data set into csv or txt</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894270#M353259</link>
      <description>Why should i have headlines? I export sas data set into csv or txt file. I dont export summary reports where headlines are recommended</description>
      <pubDate>Thu, 14 Sep 2023 14:25:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894270#M353259</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2023-09-14T14:25:44Z</dc:date>
    </item>
    <item>
      <title>Re: Export big sas data set into csv or txt</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894273#M353261</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Why should i have headlines? I export sas data set into csv or txt file. I dont export summary reports where headlines are recommended&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Some other application may need to know what each column represents. If you don't provide a header than no-one looking at the file knows what is where.&lt;/P&gt;
&lt;P&gt;Since you are just "exporting" and &lt;STRONG&gt;not controlling the order of columns&lt;/STRONG&gt; then you apparently have no concern what order any of the values appear in the resulting file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tell me what this means:&lt;/P&gt;
&lt;PRE&gt;34890,16.53,AB-PDQ&lt;/PRE&gt;
&lt;P&gt;No header so I doubt that you guessed the columns were 1) instrument identification, 2)hourly mean reading and 3) control setting&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I am told to write to a specific file structure where the order of the variables is important then the only approach I would use is a DATA Step because I never worry about the order of variables in set because it can change too easily.&lt;/P&gt;
&lt;P&gt;Consider:&lt;/P&gt;
&lt;PRE&gt;data example;
    length height 8;
   set sashelp.class;
run;&lt;/PRE&gt;
&lt;P&gt;Where the first variable in SASHELP.CLASS is Name the resulting set above has Height as the first variable.&lt;/P&gt;
&lt;P&gt;So if I EXPORT Sashelp.class and Example because they have the same values they will have data in a different order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS: I would never export such a large set to CSV named file because I know some idiot is going to open it in Excel and lose 200+ million rows of data and complain.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 14:42:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894273#M353261</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-09-14T14:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: Export big sas data set into csv or txt</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894292#M353276</link>
      <description>&lt;P&gt;Please learn to read.&lt;/P&gt;
&lt;P&gt;Quote from my post:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;If you use #4, you must add code to write the headerline, &lt;FONT color="#FF0000"&gt;if such is required&lt;/FONT&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Thu, 14 Sep 2023 15:41:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894292#M353276</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-09-14T15:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: Export big sas data set into csv or txt</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894293#M353277</link>
      <description>&lt;P&gt;And your methods 1 to 3&amp;nbsp;&lt;U&gt;will&lt;/U&gt; create headers.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 15:49:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894293#M353277</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-09-14T15:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Export big sas data set into csv or txt</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894295#M353279</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Why should i have headlines? I export sas data set into csv or txt file. I dont export summary reports where headlines are recommended&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So you don't want variable names in the data set?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2/3 are essentially equivalent.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4 is data step where you specify everything so it's the most efficient as it does exactly what you tell it to and nothing else.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 has the most overhead as it's designed to do a lot more so there's more options it works through.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4 is the fastest.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2/3 are the easiest to program.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 16:02:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-big-sas-data-set-into-csv-or-txt/m-p/894295#M353279</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-09-14T16:02:31Z</dc:date>
    </item>
  </channel>
</rss>

