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

I have a simple STP, code below, invoked from the SPWA which is writing tagsets.ExcelXP output.  I've tried different combos of the filename suffix, setting the MIME via stpsrv and appsrv, specifying "file=_webout", nothing works.  The output only displays in a new browser window ( the XML is 100% correct, I can copy / save and open successfully with Excel 2010 ).  Searching ODS and STP communities, been beating my head against the wall toooooo long, any insight will be most appreciated.

The browser is IE v7 ( I know, corp standard!! ).

%let _odsdest = tagsets.excelXP;

%let _odsoptions =;

%let _odsstyle = sasweb;

%let dto = %sysfunc(putn("&dt"d,yymmddd10.));

%let rv = %sysfunc( stpsrv_header('Content-type','application/vnd.ms-excel') );

%let rv = %sysfunc( stpsrv_header('Content-disposition',"attachment; filename=mor_missing_system_userids_&dto..xml"));

%STPBEGIN;

<snip>

*  End EG generated code (do not edit this line);

<snip>

ods tagsets.excelxp

  options ( sheet_name = 'Overall' absolute_column_width='30,10' zoom='80');

ods listing close;

ods noresults;

proc print data = system_nm noobs label;

  label system_nm = 'System NM'

  cnt = 'Count';

  format cnt comma12.;

run;

ods tagsets.excelxp style=statistical

  options ( sheet_name = 'none'

  sheet_label = ' '

  sheet_interval = 'Bygroup'

  absolute_column_width = '10,10,15,25,25,30,7'

  embedded_titles = 'yes'

  autofilter = 'yes'

  zoom = '80'

  );

proc report data = warning_defaulted_srf_d nowindows ;

  by system_nm;

  columns employee_project_nm employee_pillar_nm employee_department_nm reporting_entity_nm

  event_userid comment cnt;

<snip>

run;

ods tagsets.excelxp close;

ods listing;

ods results;

1 ACCEPTED SOLUTION

Accepted Solutions
Quentin
Super User

My code for stpsrv_header doesn't have thoe quote marks in your code.  Don't need them in macro %LET statement.

That could definitely be the problem.  Mine looks like:

  %let rc=%sysfunc(stpsrv_header(Content-type,application/vnd.ms-excel));
  %let rc=%sysfunc(stpsrv_header(Content-disposition,attachment%str(;) filename=ReportFile.xls));
BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

View solution in original post

4 REPLIES 4
Quentin
Super User

Quick glance, looks reasonable.

Why the second line? :

  %let _odsoptions= ;

Maybe that is over-writing some options set by SPWA.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
droog
Calcite | Level 5

Quentin:  I commented out the _odsoptions line, same thing...

Quentin
Super User

My code for stpsrv_header doesn't have thoe quote marks in your code.  Don't need them in macro %LET statement.

That could definitely be the problem.  Mine looks like:

  %let rc=%sysfunc(stpsrv_header(Content-type,application/vnd.ms-excel));
  %let rc=%sysfunc(stpsrv_header(Content-disposition,attachment%str(;) filename=ReportFile.xls));
BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
droog
Calcite | Level 5

Bingo.  Initially I had the STPSRV invocations in a data _null_, made them macro and forgot to take off the quotes....

Thanks much Quentin.

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
  • 1718 views
  • 0 likes
  • 2 in conversation