Data visualization with SAS programming

O(DS) Christmas Tree

Reply
Contributor tc
Contributor
Posts: 74

O(DS) Christmas Tree

OdsXmasTree.png

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;
SAS Super FREQ
Posts: 1,080

Re: O(DS) Christmas Tree

Very cool, indeed.

Respected Advisor
Posts: 3,060

Re: O(DS) Christmas Tree

Nice. I think it is right up there with the cowboy hat!

Super User
Posts: 1,228

Re: O(DS) Christmas Tree

An awesome trignometric SASmas tree! Smiley Happy Heart Nice work.

Ask a Question
Discussion stats
  • 3 replies
  • 1470 views
  • 9 likes
  • 4 in conversation