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;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 570 views
  • 0 likes
  • 1 in conversation