data xmastree;
r=4; h=11.25;
a=arsin(r/(r**2+h**2)**.5);
do y=-r to r by .02;
do x=-r to r by .02;
z=h-(x**2+y**2)**.5/sin(a)*cos(a);
if (x**2+y**2)**.5>4 | 1.25<z<2|3.25<z<4|5.25<z<6|7.25<z<8|9.25<z<10 then z=.;
output;
end;
end;
proc template;
define statgraph xmastree;
begingraph;
drawtext textattrs=(size=50pt COLOR=gold FAMILY="Arial Unicode MS") {unicode "2605"x} /
anchor=topleft widthunit=percent x=46.5 y=99 justify=center ;
layout overlay3d / cube=false;
surfaceplotparm x=x y=y z=z / fillattrs=(color=forestgreen);
endlayout;
endgraph;
end;
proc sgrender data=xmastree template=xmastree;
run;
Very cool, indeed.
Nice. I think it is right up there with the cowboy hat!
An awesome trignometric SASmas tree! Nice work.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.