BookmarkSubscribeRSS Feed
tc
Lapis Lazuli | Level 10 tc
Lapis Lazuli | Level 10

ThanksgivingTurkeyCrown.png

  

Here's a SAS ODS Graphics (GTL) take on those Turkey headband craft projects for kids. Happy Thanksgiving, all!

 

* Fun With SAS ODS Graphics: Thanksgiving Turkey Crown
  Inspired by turkey headband craft for kids at etsy.com/listing/1077344850/thanksgiving-turkey-paper-crown-kids;

data feathers;                                * Generate angles, x/y points for 7 feathers;
r=535;
retain fxo 711.5 fyo 615;                     * Triangles originate at x=711.5, y=615; 
do aDeg=180 to 360 by 180/7;                  * aDeg is angle in degrees; 
  aRad=2*constant("pi")*(aDeg/360);           * aRad is angle in radians;
  fx=r*cos(aRad)+711.5;                       * Compute x,y coordinates;
  fy=r*sin(aRad)+615;              
  c+1;                                        * Assign 1 of 4 colors (will cycle thru them);
  color=mod(c-1,4);  
  output;
end;
                                              * Generate polygon points for feathers (triangles);                     
data featherspolygons(keep=polyfid polyfx polyfy color);
set feathers;
retain pfx pfy;
if _n_>1 then do;
  polyfid+1; polyfx=pfx; polyfy=pfy; output; polyfx=fx; polyfy=fy; output; polyfx=711.5; polyfy=615; output; end;
pfx=fx; pfy=fy;
                                              * Generate points, lengths, slopes for ellipses to gently round ends of triangular feathers;                     
data feathersellipses(keep=ellipsefid ellipsefx ellipsefy ellipseslope major minor color);
set feathers;
retain pfx pfy;
if _n_>1 then do;
  ellipseslope=(fy-pfy)/(fx-pfx); ellipsefid+1; ellipsefx=(fx+pfx)/2; ellipsefy=(fy+pfy)/2; major=sqrt((fy-pfy)**2+(fx-pfx)**2)/2; minor=60; output; end;
pfx=fx; pfy=fy;

data polybeak;                                * Generate polygon points for beak (triangle);
polybid=1; polybx=641; polyby=660; output; polybx=782; output; polybx=711.5; polyby=750; output;

data polyheadband;                            * Generate polygon points for headband (rectangle);
id=1;
px=711.5-591.5; py=600; output; px=711.5+591.5; output; py=810; output; px=711.5-591.5; output;

data turkeyparts;                             * Merge all the parts together;
set featherspolygons feathersellipses polybeak polyheadband;

proc template;                                * Use GTL to plot parts of the turkey (above polygons/ellipses + new parts specfied below);
define statgraph turkey;
begingraph / border=false backgroundcolor=silver datacolors=(cx704204 red orange yellow sienna red orange yellow sienna red); * Thanksgiving-themed colors;
layout overlayequated / border=false backgroundcolor=silver wallcolor=silver WALLDISPLAY=(FILL)
  xaxisopts=(display=none thresholdmin=0 thresholdmax=0) yaxisopts=(display=none reverse=true);                           * Reverse y-axis, since x/y points came from MS-Paintbrush (where y=0 is at top instead of bottom);
polygonplot x=px y=py id=id / display=(fill) fillattrs=(color=brown);                                                     * Headband;
ellipseparm semimajor=591.5 semiminor=120 slope=0 xorigin=711.5 yorigin=600 / display=(fill) fillattrs=(color=lightgrey); * Headband top/inside;
polygonplot x=polyfx y=polyfy id=polyfid / display=(fill) group=color;                                                    * Feathers; 
ellipseparm semimajor=352 semiminor=245 slope=0 xorigin=711.5 yorigin=615 / display=(fill) fillattrs=(color=brown);       * Head;
ellipseparm semimajor=30 semiminor=30 slope=0 xorigin=558 yorigin=592 / display=(fill) fillattrs=(color=black);           * Left eye;
ellipseparm semimajor=30 semiminor=30 slope=0 xorigin=865 yorigin=592 / display=(fill) fillattrs=(color=black);           * Right eye;
ellipseparm semimajor=591.5 semiminor=120 slope=0 xorigin=711.5 yorigin=810 / display=(fill) fillattrs=(color=brown);     * Bottom of headband;
ellipseparm semimajor=40 semiminor=90 slope=0 xorigin=711.5 yorigin=790 / display=(fill)  fillattrs=(color=redorange);    * Turkey's 'snood';
polygonplot x=polybx y=polyby id=polybid / display=(fill outline) fillattrs=(color=yellow) outlineattrs=(color=redorange thickness=4pt); * Outlined beak;
ellipseparm semimajor=major semiminor=minor slope=ellipseslope xorigin=ellipsefx yorigin=ellipsefy / group=color display=(fill); * Rounded tips of feathers;
endlayout;
entryfootnote textattrs=(size=24pt weight=bold color=black) "HAPPY THANKSGIVING!";                                        * Greetings!;
endgraph;
end;
run;

proc sgrender data=turkeyparts template=turkey; * Generate chart!;
run;

 

ROUGH DRAFT

ThanksgivingTurkeyCrownWireframe.png

14 REPLIES 14
hw
Pyrite | Level 9 hw
Pyrite | Level 9
/*===========================================
  1. Create gratitude words with weights
===========================================*/
data gratitude_words;
    length word $20;
    input word $ size_weight;
datalines;
Family      28
Health      26
Friends     30
Hope        22
Kindness    25
Nature      20
Learning    24
Laughter    22
Community   21
Sunshine    19
Comfort     20
Peace       23
Patience    18
Gratitude   32
;
run;

/*===========================================
  2. Assign random XY positions for scatter plot
===========================================*/
data wordcloud;
    set gratitude_words;
    /* random positions in a 0–100 space */
    x = rand("uniform") * 100;
    y = rand("uniform") * 100;

    /* Convert weight to approximate text size */
    text_size = size_weight;

    /* Random pastel colors */
    array colors[5] _temporary_ (1 2 3 4 5);
    color = colors[ceil(rand("uniform")*5)];
run;

/*===========================================
  3. Plot the word cloud
===========================================*/
ods graphics / reset width=10in height=8in noborder;

proc sgplot data=wordcloud noautolegend;
    /* Word cloud using TEXT plot */
    text x=x y=y text=word / 
        textattrs=(weight=bold)
        sizeresponse=text_size sizemin=8 sizemax=32
        colormodel=(blue red violet green orange)
        COLORRESPONSE=color
        ;

    xaxis display=none;
    yaxis display=none;
    title height=20pt "Gratitude Word Cloud";
run;

SAS gratitude word cloud - HW.png

Ratnakar
Calcite | Level 5

This post uses a scatter plot with custom markers to display a statistic about the percentage of Americans eating turkey for Thanksgiving.

DhirenPadiya
Calcite | Level 5

This post uses a scatter plot with custom markers to display a statistic about the percentage of Americans eating turkey for Thanksgiving.

janeeumali
Calcite | Level 5
This was such a fun and clever use of ODS Graphics! I love seeing SAS used in creative, unexpected ways. The way you combined polygons, ellipses, and GTL design elements is brilliant. Thanks for sharing—definitely brightened my day!

data circle_points;
r=200; cx=0; cy=0;
do angle=0 to 360 by 15;
rad=angle*constant("pi")/180;
x=cx + r*cos(rad);
y=cy + r*sin(rad);
output;
end;
run;

proc sgplot data=circle_points;
series x=x y=y / markers;
run;
Lyka
Calcite | Level 5
data poly;
id=1; x=0; y=0; output;
x=2; y=5; output;
x=4; y=0; output;
run;

proc sgplot data=poly;
polygon id=id x=x y=y / fill fillattrs=(color=orange);
run;
MarianP
Calcite | Level 5
data ell;
x0=0; y0=0;
major=60; minor=25; slope=0.3;
run;

proc sgplot data=ell;
ellipseparm semimajor=major semiminor=minor
slope=slope xorigin=x0 yorigin=y0 / fill;
run;
Joydeva
Fluorite | Level 6
data tree;
id=1; x=0; y=0; output;
x=5; y=10; output;
x=10; y=0; output;
run;

proc sgplot data=tree;
polygon id=id x=x y=y / fill fillattrs=(color=green);
run;
Diannealcantara
Fluorite | Level 6
data badge;
r=80; cx=0; cy=0;
do angle=0 to 360 by 5;
rad=angle*constant("pi")/180;
x=cx+r*cos(rad);
y=cy+r*sin(rad);
output;
end;
run;

proc sgplot data=badge;
polygon id=1 x=x y=y / fill fillattrs=(color=gold);
run;
janeaquiatan
Fluorite | Level 6
proc template;
define statgraph basic;
begingraph;
layout overlay;
scatterplot x=x y=y;
endlayout;
endgraph;
end;
run;

proc sgrender data=sashelp.class template=basic;
run;
Jaymal
Fluorite | Level 6
data eyes;
x0=0; y0=0; major=30; minor=20; output;
x0=70; y0=0; major=30; minor=20; output;
run;

proc sgplot data=eyes;
ellipseparm semimajor=major semiminor=minor
xorigin=x0 yorigin=y0 / fill;
run;
MalatJ
Calcite | Level 5
proc sgplot data=sashelp.class;
  highlow x=name low=0 high=height / type=bar fillattrs=(color=steelblue);
run;
fatimacanobas04
Calcite | Level 5

proc template;
define statgraph turkey;
begingraph / border=false backgroundcolor=#f4f2e9
datacolors=(#8B4513 #CC5500 #E3963E #FFD97D #7A5230
#CC5500 #E3963E #FFD97D #7A5230);

layout overlayequated / border=false
backgroundcolor=#f4f2e9 wallcolor=#f4f2e9
WALLDISPLAY=(FILL)
xaxisopts=(display=none thresholdmin=0 thresholdmax=0)
yaxisopts=(display=none reverse=true);

polygonplot x=px y=py id=id / display=(fill)
fillattrs=(color=#7A5230); /* Headband */

ellipseparm semimajor=591.5 semiminor=120 slope=0
xorigin=711.5 yorigin=600 / display=(fill)
fillattrs=(color=#d9d5cc); /* Headband inner */

polygonplot x=polyfx y=polyfy id=polyfid / display=(fill) group=color;

ellipseparm semimajor=352 semiminor=245 slope=0

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats