%let gpath=C:\;
%let dpi=200;
ods html close;
ods listing gpath="&gpath" image_dpi=&dpi;
/*--Compute coordinates for sinusoidal line--*/
data timeline;
pi=constant("PI");
a=200;
do angle=0 to 7.5*360 by 10;
y=(1+angle/36);
y50=y+50;
x=a*sin(angle*pi/180);
output;
end;
run;
/*--Timeline curve--*/
data LifeExpectancy;
pi=constant("PI");
a=200;
do angle=0 to 7.5*360 by 10;
y=(50+angle/36);
x=a*sin(angle*pi/180);
value=20*angle/360;
xage=.; yage=.; age=.;
if mod(value, 5)=0 then do;
xage=x; yage=y; age=value;
end;
output;
end;
run;
/*ods html;*/
/*proc print;run;*/
/*ods html close;*/
/*--Animal with ages--*/
/*--Use same equation as above to compute (x, y) for age--*/
data animals;
keep animal xicon yicon ylbl;
input animal $1-15 age;
pi=constant("PI");
a=200;
angle=age*360 / 20;
yicon=(50+angle/36)-2;
xicon=a*sin(angle*pi/180);
ylbl=yicon+2;
datalines;
DragonFly 1
Mouse 4
Squirrel 9
QueenAnt 16
Bear 37
Turtle 44
Elephant 49
Parrot 66
Human 100
;
run;
/*ods html;*/
/*proc print;run;*/
/*ods html close;*/
/*--Combine the timeline and animal ages--*/
data combined;
set lifeExpectancy animals;
run;
/*ods html;*/
/*proc print;run;*/
/*ods html close;*/
/*--Sine Wave--*/
ods graphics / reset width=3in height=4in imagename='TimeLineLog';
title 'Time Line Y=1 to 750';
proc sgplot data=timeline nowall noborder subpixel noautolegend;
series x=x y=y / lineattrs=(thickness=3) transparency=0.5;
xaxis display=none offsetmin=0.05 offsetmax=0.05;
yaxis display=none reverse type=log logbase=2;
run;
/*--Sine Wave--*/
ods graphics / reset width=3in height=4in imagename='TimeLineLog_50';
title 'Time Line Y= 50 to 800';
proc sgplot data=timeline nowall noborder subpixel noautolegend;
series x=x y=y50 / lineattrs=(thickness=3) transparency=0.5;
xaxis display=none offsetmin=0.05 offsetmax=0.05;
yaxis display=none reverse type=log logbase=2;
run;
/*--Icon File Names--*/
%let human=&gpath..\Icons\David_Trans.png;
%let parrot=&gpath..\Icons\Parrot_Trans.png;
%let elephant=&gpath..\Icons\Elephant_Trans.png;
%let turtle=&gpath..\Icons\Turtle_Trans.png;
%let bear=&gpath..\Icons\Bear_Trans.png;
%let queenant=&gpath..\Icons\QueenAnt_Trans.png;
%let squirrel=&gpath..\Icons\Squirrel_Trans.png;
%let mouse=&gpath..\Icons\Mouse_Trans.png;
%let dragonfly=&gpath..\Icons\DragonFly_Trans.png;
/*--Make Graph--*/
ods graphics / reset width=5in height=5in imagename='LifeExpectancyLabel';
title 'Life Expectancy for Different Animals';
footnote j=l h=6pt 'Maximum age, in years that certain animals may be expected to reach, based on reports of zoos and estimates of biologists.';
footnote2 j=l h=6pt'Data from S. S. Flower, "The Duration of Life in Animals", Proceedings of the London Zoological Society.';
footnote3 j=l h=6pt 'Based on 2010 Encyclopedia Britannica, Inc.';
proc sgplot data=combined nowall noborder subpixel noautolegend;
symbolimage name=human image="&human";
symbolimage name=parrot image="&parrot" / voffset=-0.2;
symbolimage name=elephant image="&elephant";
symbolimage name=turtle image="&turtle";
symbolimage name=bear image="&bear";
symbolimage name=queenant image="&queenant";
symbolimage name=squirrel image="&squirrel";
symbolimage name=mouse image="&mouse";
symbolimage name=dragonfly image="&dragonfly";
styleattrs datasymbols=(dragonfly mouse squirrel queenant bear turtle elephant parrot human);
series x=x y=y / lineattrs=(thickness=3) transparency=0.5;
text x=xage y=yage text=age / position=top textattrs=(size=6);
scatter x=xicon y=yicon / group=animal nomissinggroup markerattrs=(size=30);
text x=xicon y=ylbl text=animal / position=bottom textattrs=(size=6);
xaxis display=none offsetmin=0.05 offsetmax=0.05;
yaxis display=none reverse type=log logbase=2;
run;