Your SAS programs, embedded in web apps and elsewhere

Stored process report in Excel format

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 6
Accepted Solution

Stored process report in Excel format

Hi All,

 

I'm viewing the Stored process reports from Stored process Web application.

I tried the following code it's working fine for PDF, HTML and RTF fromats.

How Can I get Excel format report?

any suggestions..

 

[Pre] %if %upcase(&_odsdest)=PDF %then %do;
%let _odsstyle=printer;
%let _odsstylesheet=;
%let _odsoptions=bookmarkgen=no compress=9
startpage=no;
%end;
%else %if %upcase(&_odsdest)=RTF %then %do;
%let _odsstyle=rtf;
%let _odsstylesheet=;
%let _odsoptions=bodytitle startpage=no
nokeepn notoc_data;
%end;


Accepted Solutions
Solution
Thursday
SAS Super FREQ
Posts: 302

Re: Stored process report in Excel format

You can use this code to create an XLSX file using SAS 9.4M3 and later:

 

ods _all_ close; 

data _null_;
rc = appsrv_header('Content-type', 'application/vnd.ms-excel');
rc = appsrv_header('Content-disposition','attachment; filename="Class.xlsx"');
run;

ods Excel file=_webout style=HTMLBlue; 
  proc print data=sashelp.class; run; quit; 
ods Excel close;

 

The older ExcelXP tagset works, too:

 

ods _all_ close; 

data _null_;
rc = appsrv_header('Content-type', 'application/vnd.ms-excel');
rc = appsrv_header('Content-disposition','attachment; filename="Class.xml"');
run;

ods tagsets.ExcelXP file=_webout style=HTMLBlue; 
  proc print data=sashelp.class; run; quit; 
ods tagsets.ExcelXP close;

 

Be sure to deselect Include code for Stored process macros in Step 2 of the SAS Enterprise Guide wizard, and select Stream in Step 3.

 

Vince DelGobbo

SAS R&D

View solution in original post


All Replies
SAS Super FREQ
Posts: 302

Re: Stored process report in Excel format

Just to clarify, are you interested in creating a stored process, or a stored process report?  They are two different things and the approach depends on which format that you need.

 

Also, what version of SAS are you running.

 

Vince DelGobbo

SAS R&D

Occasional Contributor
Posts: 6

Re: Stored process report in Excel format

>are you interested in creating a stored process, or a stored process report?

                     I'm creating Stored Process in Enterprise guide.. My requirement - I want the result in Excel format when I run it from Stored Process Web application.

 

>what version of SAS are you running?

        SAS 9.4 M3

Solution
Thursday
SAS Super FREQ
Posts: 302

Re: Stored process report in Excel format

You can use this code to create an XLSX file using SAS 9.4M3 and later:

 

ods _all_ close; 

data _null_;
rc = appsrv_header('Content-type', 'application/vnd.ms-excel');
rc = appsrv_header('Content-disposition','attachment; filename="Class.xlsx"');
run;

ods Excel file=_webout style=HTMLBlue; 
  proc print data=sashelp.class; run; quit; 
ods Excel close;

 

The older ExcelXP tagset works, too:

 

ods _all_ close; 

data _null_;
rc = appsrv_header('Content-type', 'application/vnd.ms-excel');
rc = appsrv_header('Content-disposition','attachment; filename="Class.xml"');
run;

ods tagsets.ExcelXP file=_webout style=HTMLBlue; 
  proc print data=sashelp.class; run; quit; 
ods tagsets.ExcelXP close;

 

Be sure to deselect Include code for Stored process macros in Step 2 of the SAS Enterprise Guide wizard, and select Stream in Step 3.

 

Vince DelGobbo

SAS R&D

Occasional Contributor
Posts: 6

Re: Stored process report in Excel format

Thanks you so much @Vince_SAS. It's working

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 108 views
  • 3 likes
  • 2 in conversation