BookmarkSubscribeRSS Feed
PSI_frank
Calcite | Level 5

Greetings,

I have been given the requirement of downloading a custom report as a native Excel binary file and not as a XML file.

The user selects options in SAS Information Delivery Portal to create a custom report and then this report is returned to the user as an Excel file.  The simplified code below is what I currently have.

Thanks in advance,

F

*  Begin EG generated code (do not edit this line);

*

*  Stored process registered by

*  Enterprise Guide Stored Process Manager V4.3

*

*  ====================================================================

*  Stored process name: Stored Process for DDE

*  ====================================================================

*;

*ProcessBody;

       

data null_;

rc = stpsrv_header('Content-type','application/vnd.ms-excel');

rc = stpsrv_header('Content-disposition','attachment; filename=_.xls');

run;

%let _odsdest=phtml;

%STPBEGIN;

proc print data=sashelp.class;

run;

%STPEND;

*  Begin EG generated code (do not edit this line);

;*';*";*/;quit;

*  End EG generated code (do not edit this line);

;

1 REPLY 1
Cynthia_sas
SAS Super FREQ

Hi:

  When you use ODS, you are creating ASCII text files (either CSV, HTML or XML) that Excel knows how to open and render. I see you are using PHTML -- this is an HTML format with very little style (and not an XML format).

  The only ways to deliver true, binary Excel files is to use PROC EXPORT or the LIBNAME engine for Excel. You might want to work with Tech Support on this question, because you would NOT use a stored process the way you are -- with ODS.

cynthia

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1 reply
  • 1217 views
  • 0 likes
  • 2 in conversation