BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
vkrishna
Quartz | Level 8

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;

1 ACCEPTED SOLUTION

Accepted Solutions
Vince_SAS
Rhodochrosite | Level 12

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

4 REPLIES 4
Vince_SAS
Rhodochrosite | Level 12

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

vkrishna
Quartz | Level 8

>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

Vince_SAS
Rhodochrosite | Level 12

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

vkrishna
Quartz | Level 8

Thanks you so much @Vince_SAS. It's working

SAS INNOVATE 2024

innovate-wordmarks-white-horiz.png

SAS is headed back 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.

Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!

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.

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
  • 4 replies
  • 1208 views
  • 4 likes
  • 2 in conversation