Here is a code snippet I came up with today to save output with various _odsoptions AND allow the users to choose what type of output they need: RTF, PDF, or HTML.
(Note that this will default to PDF if the user doesn't pick anything. Also there is a report parameter of company that the user chooses. This defines not only the report itself but the filename default!)
%global company _odsdest _odsstyle _odsoptions; %let _odsstyle=SASWEB; %macro head; %put "&&_odsdest."; %if "&&_odsdest." = "RTF" %then %do; %let _odsoptions = startpage=NO; data _null_; rc = stpsrv_header('Content-type',"application/&&company..msword;"); rc = stpsrv_header('Content-disposition',"attachment; filename=&&company..rtf;"); run; %end; %IF %length(&_odsdest) = 0 or "&&_odsdest." = "PDF" %THEN %DO ; %let _odsdest=PDF; %let _odsoptions = startpage=NO notoc; %symdel _ODSSTYLESHEET; data _null_; rc = stpsrv_header('Content-type','application/pdf'); rc = stpsrv_header('Content-disposition',"attachment; filename=&&company..pdf;"); run; %end; %mend; %head; %stpbegin; * insert your sas code here %stpend; |