A quick SAS ODS Graphics take on kids' construction paper Thanksgiving turkey projects. Happy holidays!
* Fun w/SAS ODS Graphics: Construction Paper Thanksgiving Turkey
Compare to craft project photo at etsy.com/listing/816756558/paper-craft-thanksgiving-turkey;
data turkey; * Need points for 10 ellipses that make up turkey's "feathers";
r=1;
retain px py 0; * Origin;
do aDeg=-30 to 210 by 24; * aDeg is angle in degrees;
aRad=2*constant("pi")*r*aDeg/360; * aRad is angle in radians;
x=r*cos(aRad); * Compute x,y coordinates;
y=r*sin(aRad);
c+1; * Assign 1 of 4 colors (cycle thru them);
color=mod(c-1,4);
slope=y/x; * Compute slope of "feathers" (ellipses);
output;
end;
* Use SAS ODS Graphics GTL to draw "construction paper" turkey (Ellipses + Oval/Polygon/Text annotations);
ods listing image_dpi=300 gpath='/folders/myfolders';
ods graphics on / reset antialias width=8in height=8in imagename="Turkey2020";
proc template;
define statgraph turkey;
begingraph / datacolors=(sienna red orange yellow sienna red orange yellow sienna red); * Thanksgiving-themed colors;
layout overlayequated / xaxisopts=(display=none thresholdmin=0 thresholdmax=0) yaxisopts=(display=none);
entry textattrs=(size=24pt weight=bold color=black) "HAPPY THANKSGIVING!"/ valign=top;
scatterplot x=px y=py; * "Dummy" plot - single point (x=0, y=0), needed for ellipseparms);
* "Feathers" (thanksgiving-themed color ellipses);
ellipseparm semiminor=.35 semimajor=.75 xorigin=x yorigin=y slope=slope / display=(fill) group=color;
* "Body" (brpwn ellipse);
ellipseparm semiminor=.7 semimajor=.7 xorigin=0 yorigin=0 slope=0 / display=(fill) fillattrs=(color=brown);
* "Head" (brpwn ellipse);
ellipseparm semiminor=.4 semimajor=.4 xorigin=0 yorigin=.75 slope=0 / display=(fill) fillattrs=(color=brown);
* "Pupils" (black ovals);
drawoval x=-.1 y=.925 / drawspace=datavalue HEIGHT=1.75 WIDTH=1.75 display=(fill) fillattrs=(color=black);
drawoval x=.1 y=.925 / drawspace=datavalue HEIGHT=1.75 WIDTH=1.75 display=(fill) fillattrs=(color=black);
* "Snood" (red tilde character, rotated 90 degrees);
drawtext textattrs=(size=82pt color=red weight=bold) "~" / drawspace=datavalue rotate=90 x=-.075 y=.84 anchor=right;
* "Beak" (yellow triangle);
beginpolygon x=-.1 y=.825 / drawspace=datavalue display=(fill) fillAttrs=(color=yellow); draw x=.1 y=.825; draw x=0 y=.65; endpolygon;
entry textattrs=(size=24pt weight=bold color=black) "2020"/ valign=bottom;
endlayout;
endgraph;
end;
run;
proc sgrender data=turkey template=turkey; * Generate chart!;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.