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