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

I have the same problem as described in the post https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-EXCEL-in-Web-StoreProcess/m-p/270003#M1586...

Also my stored process will run in Web, I would generate a report with ODS EXCEL and user should download the file.

 

I tryed the solution, but I don't get a valid result. The generated file contains html and any binary data. Here the code I used:

ods _all_ close;

data _null_;

rc = stpsrv_header('Content-type','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');

rc = stpsrv_header('Content-disposition','attachment; filename=test.xlsx');

run;

%stpbegin;

ods excel file = _webout ;

ods excel style = Plateau;

proc print noobs label data=sashelp.TOURISM; run;

%stpend;

ods excel close;

 

Attached the generated file.

 

Any suggestions?

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

Hi

 

Your code should look like this:

ods excel file=_webout style=plateau;

data _null_;
  rc = stpsrv_header('Content-type','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
  rc = stpsrv_header('Content-disposition','attachment; filename=test.xlsx');
run;

proc print noobs label data=sashelp.class;
run;

ods excel close;

If you use SAS Enterprise Guide to create the Stored Process, make sure EG does not automatically add the %stpbegin %stpend macros

 

Bruno

View solution in original post

4 REPLIES 4
BrunoMueller
SAS Super FREQ

Hi

 

Your code should look like this:

ods excel file=_webout style=plateau;

data _null_;
  rc = stpsrv_header('Content-type','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
  rc = stpsrv_header('Content-disposition','attachment; filename=test.xlsx');
run;

proc print noobs label data=sashelp.class;
run;

ods excel close;

If you use SAS Enterprise Guide to create the Stored Process, make sure EG does not automatically add the %stpbegin %stpend macros

 

Bruno

arial34
Fluorite | Level 6

Thank you for your reply.

When I do it so, I get an exception:

javax.servlet.ServletException: Servlet execution threw an exception
com.sas.svcs.webapp.servlet.filters.LocaleFilter.onDoFilter(LocaleFilter.java:69)
com.sas.framework.webapp.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:74)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
com.sas.svcs.webapp.servlet.filters.ThemeSupportFilter.onDoFilter(ThemeSupportFilter.java:180)
com.sas.framework.webapp.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:74)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

Any ideas?

BrunoMueller
SAS Super FREQ

Hi

 

The proposed code worked well for me with SAS9.4 on a Linux environment.

 

I think it is best to contact SAS support for problems like this.  See here http://support.sas.com/techsup/

 

Bruno

niko_gallo
Obsidian | Level 7

hi,

how can I print a title on the web page after export?

thanks

Niko

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 4 replies
  • 4398 views
  • 1 like
  • 3 in conversation