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
Diamond | Level 26

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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