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.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.