BookmarkSubscribeRSS Feed
herbman
Obsidian | Level 7

Hello,

 

I have two different projects both can run correctly under HTML,  but when _odsdest had values defined as PDF and Word, somehow one can have right Word and PDF file generated and another was only with messy code displayed. I appreciate any help on how to fix the bad one. I compared all SAS macro variables and looked they are the same.

 

Thank you!

 

Limin Shu

%macro print;

%if %upcase(&_odsdest) eq PDF %then %do;
%let rc = %sysfunc(stpsrv_header(Content-type,application/vnd.pdf));
%let rc = %sysfunc(stpsrv_header(Content-disposition,attachment%str(;) filename=mypdf.pdf));
%let _odsdest=PDF;
%end;
%else %if %upcase(&_odsdest) eq HTML %then %do;
%let _odsdest=html;
%end;
%else %if %upcase(&_odsdest) eq HTML2WORD %then %do;
%let rc = %sysfunc(stpsrv_header(Content-type,application/msword));
%let rc = %sysfunc(stpsrv_header(Content-disposition,attachment%str(;) filename=report.doc));
%let _odsdest=RTF;
%end;

%STPBEGIN;

%Super_2pt;

%Plotout;

%STPEND;

%done:
%mend print;
%PRINT;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 0 replies
  • 520 views
  • 0 likes
  • 1 in conversation