BookmarkSubscribeRSS Feed
Rhino84
Fluorite | Level 6

I need SAS code to successfully export 2 million records (2 million rows X 12 columns )  in Excel file

8 REPLIES 8
Reeza
Super User

Reeza_0-1638909045298.png

https://support.microsoft.com/en-us/office/excel-specifications-and-limits-1672b34d-7043-467e-8e27-2...

 


@Rhino84 wrote:

I need SAS code to successfully export 2 million records (2 million rows X 12 columns )  in Excel file




Rhino84
Fluorite | Level 6
I can use CSV though ?
ballardw
Super User

@Rhino84 wrote:
I can use CSV though ?

How will you use the CSV?

 

Reeza
Super User
CSV is not Excel, it's a text file. Are you updating your question to ask how to export your data to a CSV file?

If so, see the tutorial here:
https://stats.idre.ucla.edu/sas/faq/how-do-i-write-out-a-file-that-uses-commas-tabs-or-spaces-as-del...

Excel will not be able to load a file of 2 million rows from a CSV.
Rhino84
Fluorite | Level 6
What i meanst was, i ould export my file from SAS to a csv spreadsheet too
Reeza
Super User
CSV is not a spreadsheet. It's a comma separate text file, that Excel happens to be able to read and interpret and is typically the default viewer. But you don't have formats, cells, borders or multiple sheets. Just raw data.
SASKiwi
PROC Star

Yes, you can use PROC EXPORT to create a CSV file. You just won't be able to open it in Excel.

ChrisHemedinger
Community Manager

As Reeza points out, Excel can hold only about 1 million rows per sheet. You could export with multiple passes into multiple sheets. Something like:

 

filename out "c:\project\bigexcel.xlsx";
proc export data=bigfile(obs=1000000)
  dbms=xlsx
  outfile=out replace;
  sheet="First million";
run;
proc export data=bigfile(fistobs=1000001)
  dbms=xlsx
  outfile=out replace;
  sheet="Second million";
run;

But...this is probably a terrible use for Excel and data storage. But sometimes that's what our clients ask for...

 

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 3108 views
  • 6 likes
  • 5 in conversation