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));
The Boston Area SAS Users Group is hosting free webinars!
Next up: Bart Jablonski and I present 53 (+3) ways to do a table lookup on Wednesday Sep 18.
Register now at 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.

The Boston Area SAS Users Group is hosting free webinars!
Next up: Bart Jablonski and I present 53 (+3) ways to do a table lookup on Wednesday Sep 18.
Register now at 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));
The Boston Area SAS Users Group is hosting free webinars!
Next up: Bart Jablonski and I present 53 (+3) ways to do a table lookup on Wednesday Sep 18.
Register now at 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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

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.

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