p***r 发帖数: 920 | 1 I wanna switch easily between two type of ods pdf/html, how can I code a
macro to control the on/off of ods, the manual structure is as following,
what I do so far is keeping quote and unquote which is somewhat tedious.
any suggestoin?
ods listing close;
/*ods html file="&add.\table.xls";*/
ods pdf file="&add.\table.pdf"; options orientation=landscape nodate
nonumber missing=" " papersize="letter";
ods pdf close;
/* ods html close;*/
ods listing; |
o****o 发帖数: 8077 | 2 will this work for u? If so, pls reward me some baozi
%let pdfoff=%str(*);
%let htmloff=%str(*);
ods listing close;
&htmloff. ods html file="&add.\table.xls";
&pdfoff. ods pdf file="&add.\table.pdf";
options orientation=landscape nodate
nonumber missing=" " papersize="letter";
/* yada yada yada */
&pdfoff. ods pdf close;
&htmloff. ods html close;
ods listing;
【在 p***r 的大作中提到】 : I wanna switch easily between two type of ods pdf/html, how can I code a : macro to control the on/off of ods, the manual structure is as following, : what I do so far is keeping quote and unquote which is somewhat tedious. : any suggestoin? : ods listing close; : /*ods html file="&add.\table.xls";*/ : ods pdf file="&add.\table.pdf"; options orientation=landscape nodate : nonumber missing=" " papersize="letter"; : ods pdf close; : /* ods html close;*/
|
p***r 发帖数: 920 | 3 kinda on the right track but I think there should be a better version.
【在 o****o 的大作中提到】 : will this work for u? If so, pls reward me some baozi : %let pdfoff=%str(*); : %let htmloff=%str(*); : ods listing close; : &htmloff. ods html file="&add.\table.xls"; : &pdfoff. ods pdf file="&add.\table.pdf"; : options orientation=landscape nodate : nonumber missing=" " papersize="letter"; : /* yada yada yada */ : &pdfoff. ods pdf close;
|
p***r 发帖数: 920 | 4 转给用户:oloolo,现金(伪币):20,收取手续费:0.20 |
p***r 发帖数: 920 | 5 I'm thinking of just one change can make one on and other off.
【在 o****o 的大作中提到】 : will this work for u? If so, pls reward me some baozi : %let pdfoff=%str(*); : %let htmloff=%str(*); : ods listing close; : &htmloff. ods html file="&add.\table.xls"; : &pdfoff. ods pdf file="&add.\table.pdf"; : options orientation=landscape nodate : nonumber missing=" " papersize="letter"; : /* yada yada yada */ : &pdfoff. ods pdf close;
|
o****o 发帖数: 8077 | 6 then wrap it into a macro:
%macro switch(type);
%global s1 s2;
%if %upcase(&type) eq HTML %then %do;
%let s1=html;
%let s2=xls;
%end;
%else %if %upcase(&type) eq PDF %then %do;
%let s1=pdf;
%let s2=pdf;
%end;
%mend;
%switch(pdf);
ods listing close;
ods &s1 file="&add.\table.&s2";
options orientation=landscape nodate
nonumber missing=" " papersize="letter";
ods &s1 close;
ods listing;
【在 p***r 的大作中提到】 : I'm thinking of just one change can make one on and other off.
|
d*******o 发帖数: 493 | 7 Similar to oloolo's.
%macro odsswitch(switch = );
%if %eval(&switch) = 0 %then %do;
ods html file="&add.\table.xls";
%end;
%else %if %eval(&switch) = 1 %then %do;
ods pdf file="&add.\table.pdf"
%end;
%else %goto exit;
ods _all_ close;
ods listing;
%exit:;
%mend; |