-
Notifications
You must be signed in to change notification settings - Fork 96
/
caption.sas
40 lines (37 loc) · 921 Bytes
/
caption.sas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
Title: Annotate a plot title or caption inside the plot frame
*/
%macro caption(
label, /* Caption text */
x=2, y=96, /* Plot x, y location */
htext=, /* Text height */
sys=1, /* Annotate coordinate system */
pos=, /* Annotate position for label */
color=,
out=caption /* Name of output Annotate data set */
);
data &out;
retain xsys ysys "&sys";
length text $%sysfunc(max(40, %length(&label)));
length position $1;
x=&x;
y=&y;
%if %length(&pos)=0 %then %do;
if &x < 20
then position = '6';
else if &x > 80
then position = '4';
else position = '5';
%end;
%else %do;
position = "&pos";
%end;
%if %length(&htext) %then %do;
size = &htext;
%end;
%if %length(&color) %then %do;
color = "&color";
%end;
function ='label ';
text = "&label";
%mend;