BookmarkSubscribeRSS Feed
PRAVIN_JAIN
Calcite | Level 5

We have a stored process which gives excel report to users. This get stuck when we try to download a large dataset having around 500 K observations due to insufficient memory.

 

I am using below code, is there a way we can download such a large file using ODS.

 

data _null_;
rc = stpsrv_header('Content-type','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
rc = stpsrv_header('Content-disposition',"attachment; filename=test.xlsx");
run;


ods excel file = _webout style=Plateau;
libname in_lib '/data/users/report/';

proc print data=in_lib.trans_detail;
run;
ods excel close;

3 REPLIES 3
Quentin
Super User

This is likely and ODS EXCEL issue, not an issue with the downloading.

 

What version of SAS are you on? I'd review this thread: https://communities.sas.com/t5/SAS-Programming/ODS-EXCEL-out-of-memory-error-with-dataset-containing...

 

ODS excel is great for fancy formatting, but if you're not doing anything fancy, you might be better off with PROC EXPORT or other approaches that don't have the same memory footprint.

PRAVIN_JAIN
Calcite | Level 5

I am able to export using PROC EXPORT and save to SAS server. How can we download this file to local machine if we don't use ODS, any alternative ?

Quentin
Super User

Please see my answer to this similar question, which has an example of streaming the file using data _null_ step. 

 

https://communities.sas.com/t5/SAS-Stored-Processes/webout-with-Proc-Export/td-p/393351

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1741 views
  • 0 likes
  • 2 in conversation