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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 974 views
  • 0 likes
  • 2 in conversation