/* Copyright (c) 2000 SAS Institute Inc. */ /* You may want to uncomment some of these. * The macros are cool when they use but if there's an error * it's darned hard to figure it out. */ * options spool ;* mprint ;* mtrace source source2; /* Rules for use of these macros: * 1. The arguments to %para and %section must be enclosed in double- * quotes. * This in turn means that any embedded quote characters of the * same sort as used for the quotes must be doubled, just as in * any other SAS context. * 2. These macros set the escapechar (in 8.2) to \ (backslash). * This means that you can't use a backslash as an "ordinary" * character. This will make it difficult to express MS-DOS * path names; sorry. You can use \\ to represent \. * 3. If you use a leading equal sign in the macros * [eg, %tt(option=value)], you must %str it; eg, * %tt(%str(option=value). Same goes for commas. * 4. You can't use quotes or apostrophes in %it()-type macros, * even when you use %str or %quote. I have no idea why this * is, and if any macro gurus has any insight, I'd be appreciative. */ /* There are ODS PRINTER formatting macros. * There are two versions, one for v8.1 and another for v8.2. * The idea is that you load whichever fits your version; the 8.2 * macros offer significantly more functionality, but you can put * all the encoding in 8.1 so that it will sprout the additional * functionality in 8.2 when it's available. */ %let text_style = ; %let saved_last = ; %let vertabmods = ; %let psection = ""; %let psubsection = ""; %let v82 = 0; %let ln = 0; %let fmtdest = printer; /* V9: set NOQUOTELENMAX */ %macro formatting_start(dest=&fmtdest); %let fmtdest = &dest; ods listing close; options cardimage; options debug = "pso_skip_explicit" nodate; %mend; %macro formatting_end(dest=&fmtdest); options debug = ""; %mend; %macro save_last; proc sql noprint; select setting into :saved_last from dictionary.options where optname = "_LAST_"; quit; %mend; %macro present_text(style=data, tabmods=, extra=); proc report data=text nowindows noheader style={rules=none frame=void just=l cellspacing=0 &vertabmods &tabmods}; &extra define text / style=&style; run; quit; options _last_ = &saved_last; %mend; %macro do_text(text, style=data); %save_last; data text; length text $9999; text = compbl(&psection || &psubsection || &text); run; %let psection = ""; %let psubsection = ""; %present_text(style=&style); %mend; %macro section(text); %if &v82 = 1 %then %let psection = "\1.5n\S={font_size=1.2fs font_style=italic font_weight=bold}" || &text || "\S={}\1.5n"; %else %do_text(&text, style=ProcTitle{just=l}); %mend; %macro subsection(text); %if &v82 = 1 %then %let psubsection = "\0.5n\S={font_weight=bold}" || &text || "\S={}\1.5n"; %else %do_text(&text, style=data{just=l font_weight=bold}); %mend; %macro para(text); %do_text(&text, style=data); %mend; %macro pre; %save_last; %if %length(&psection) > 2 | %length(&psubsection) > 2 %then %do_text(""); data text; length text $81; input text $char80.; text = " " || text; %mend; %macro pend; %present_text(style=dataFixed{asis=yes}, tabmods=cellpadding=0); %mend; %macro bo(text); /* bold - 8.2 only */ &text %mend; %macro it(text); /* italic - 8.2 only */ &text %mend; %macro tt(text); /* typewriter type - 8.2 only */ &text %mend; %macro style(style, text); /* Specify arbitrary style specs */ &text %mend; %macro super(text); (&text) %mend; %macro sub(text); (&text) %mend; %macro raw(text, dest=); %mend; %macro nl; " || '03'x || "n %mend; %macro list_start; %save_last; data text; length text $999; %let ln = 0; %mend; %macro item(item); %let ln = &ln + 1; which = &ln; text = compbl(&item); output; %mend; %macro list_end; %present_text(extra=%str( columns which text; define which / style={pretext=" " posttext=". " asis=yes just=r};), tabmods=cellpadding=0); %mend; %macro def_start; %save_last; data text; length text $255 meaning $999; %mend; %macro def(item, meaning); text = &item; meaning = compbl(&meaning); output; %mend; %macro def_end; %present_text(style=data{font_weight=bold}, tabmods=cellpadding=4pt); %mend; %macro copyright; " || '01'x || " %mend; %macro rtm; " || '02'x || " %mend; %macro tm; " || '04'x || " %mend; %macro setup_formatting; %if &sysver >= 8.2 %then %do; %let v82 = 1; %let vertabmods = cellpadding=0; %macro formatting_start(dest=&fmtdest); %let fmtdest = &dest; ods listing close; options cardimage nodate; ods escapechar = '\'; ods &dest startpage=no; %mend; %macro formatting_end(dest=&fmtdest); ods escapechar = ''; ods &dest startpage=yes; %mend; %macro bo(text); /* bold - 8.2 only */ \S={font_weight=bold}&text\S={} %mend; %macro it(text); /* italic - 8.2 only */ \S={font_style=italic}&text\S={} %mend; %macro tt(text); /* typewriter type - 8.2 only */ \S={font_face=courier}&text\S={} %mend; %macro style(style, text); /* Specify arbitrary style specs */ \S={&style}&text\S={} %mend; %macro super(text); \{super &text} %mend; %macro sub(text); \{sub &text} %mend; %macro raw(text, dest=/); %if %length(dest) = 1) %then %let dest = ; \&dest"&text" %mend; %end; %mend; %setup_formatting;