BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
cho16
Obsidian | Level 7

Hi

 

I need to export the SAS dataset that has more than 1 million records (1,120,897) and 35 columns to the .CSV file.

But while exporting the dataset , all the rows are not exported.

Could you please let me know how can i export all the rows to the .CSV file ?

 

proc export data=NEW dbms=xlsx

outfile="\\HFNT63\devl\web\NSLIJ_testing\NEW_ENROLLMENT.xlsx"

replace;

run;

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Oligolas
Barite | Level 11

Why are you using the xlsx DBMS if you want to create a CSV File !?

Forget your code and use the SAS utility macro (already included in SAS)

%DS2CSV Macro

 

Example:

 

%ds2csv (
   data=new, 
   runmode=b, 
   csvfile=\\HFNT63\devl\web\NSLIJ_testing\NEW_ENROLLMENT.csv
 );

 

From @ballardw

DO NOT OPEN the file with Excel. EXCEL has many limitations and behaviors that are not suited for large datasets.

 

Whatever you may be thinking of doing in Excel, you are likley better off doing in SAS and then exporting as no one in their right mind scrolls through two million lines of anything.

 

From:  https://support.office.com/en-us/article/Excel-specifications-and-limits-ca36e2dc-1f09-4620-b726-67c...

Excel 2010, 2013, 2016

Worksheet size

1,048,576 rows by 16,384 columns

So you cannot have many more than 1 million rows when opening a file in Excel.



 

________________________

- Cheers -

View solution in original post

7 REPLIES 7
ballardw
Super User

Your file name says you are NOT exporting to CSV but XLSX.

And Excel has file size limitations that CSV does not.

cho16
Obsidian | Level 7

Sorry i am trying to export the file to CSV file

 

proc export data=NEW_ENROLLMENT dbms=xlsx

outfile="\\HFNT63\devl\web\NSLIJ_testing\NEW_ENROLLMENT.csv" dbms=csv

replace;

run;

Reeza
Super User

Review your code. You still have DBMS= XLSX in there. Remove that portion. Note that you will need to open the file in a text editor not excel to verify the number of records. 

cho16
Obsidian | Level 7

Thanks Reeza !

 

But how to export more than 2 million of records by using proc export.

The query succeds in the window but when i try to open the file it shows the "file was not load completely".

Could you please let me know how to resolve this ?

ballardw
Super User

DO NOT OPEN the file with Excel. EXCEL has many limitations and behaviors that are not suited for large datasets.

 

Whatever you may be thinking of doing in Excel, you are likley better off doing in SAS and then exporting as no one in their right mind scrolls through two million lines of anything.

 

From:  https://support.office.com/en-us/article/Excel-specifications-and-limits-ca36e2dc-1f09-4620-b726-67c...

Excel 2010, 2013, 2016

Worksheet size

1,048,576 rows by 16,384 columns

So you cannot have many more than 1 million rows when opening a file in Excel.

 

Oligolas
Barite | Level 11

Why are you using the xlsx DBMS if you want to create a CSV File !?

Forget your code and use the SAS utility macro (already included in SAS)

%DS2CSV Macro

 

Example:

 

%ds2csv (
   data=new, 
   runmode=b, 
   csvfile=\\HFNT63\devl\web\NSLIJ_testing\NEW_ENROLLMENT.csv
 );

 

From @ballardw

DO NOT OPEN the file with Excel. EXCEL has many limitations and behaviors that are not suited for large datasets.

 

Whatever you may be thinking of doing in Excel, you are likley better off doing in SAS and then exporting as no one in their right mind scrolls through two million lines of anything.

 

From:  https://support.office.com/en-us/article/Excel-specifications-and-limits-ca36e2dc-1f09-4620-b726-67c...

Excel 2010, 2013, 2016

Worksheet size

1,048,576 rows by 16,384 columns

So you cannot have many more than 1 million rows when opening a file in Excel.



 

________________________

- Cheers -

jsphnwllms
Fluorite | Level 6

proc export data=NEW dbms=csv

outfile="\\HFNT63\devl\web\NSLIJ_testing\NEW_ENROLLMENT.csv"

replace;

run;

 

Do not open the file with Excel. You may import the csv file in ACCESS, but there is a 2GB size limit in ACCESS.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 7 replies
  • 160078 views
  • 6 likes
  • 5 in conversation