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
PROC Star

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));
Check out the Boston Area SAS Users Group (BASUG) video archives: https://www.basug.org/videos.

View solution in original post

4 REPLIES 4
Quentin
PROC Star

Quick glance, looks reasonable.

Why the second line? :

  %let _odsoptions= ;

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

Check out the Boston Area SAS Users Group (BASUG) video archives: https://www.basug.org/videos.
droog
Calcite | Level 5

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

Quentin
PROC Star

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));
Check out the Boston Area SAS Users Group (BASUG) video archives: https://www.basug.org/videos.
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

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