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

wreath.gif

 

A quick change-all-stars-to-hearts fork of the earlier Fun w/SAS ODS Graphics Twinkle-Twinkle-Little-Star Holiday Wreath. Happy Mother's Day, all!

 

* Fun w/SAS ODS Graphics: Happy Mother's Day Wreath of Hearts (Scatter + Text Plots)
  A fork of earlier Fun w/SAS ODS Graphics Twinkle-Twinkle-Little-Star Holiday Wreath;
  
data wreath;                                                      /* Generate points for "wreath" graph */                                              
do frame=1 to 25;                                                 /* Randomly change colors of hearts for each frame of GIF to make them twinkle */
  tx=0; ty=0; msg="HAPPY*MOTHER'S*DAY!"; output; tx=.; ty=.;      /* Happy Mother's Day! message in center of wreath */
  do theta=0 to 2*constant("pi")+.1 by (2*constant("pi"))/60;     /* Generate 60 points around a circle for hearts on wreath */  
    do r=1 to .7 by -.075;                                        /* Five con-centric circles of hearts */
      x=r*cos(theta);                                             /* A little trigonometry to get x-coordinate */                           
      y=r*sin(theta);                                             /* And y-coordinate */
      color=(rand("Integer", 0, 11));                              /* Assign a random color for a 12-pastel color ramp */
      output;
    end;
 end;  
end;

ods graphics / imagefmt=GIF width=5in height=5in noborder;        /* Record wreath images */  
options nobyline papersize=('5 in', '5 in') animduration=.2 animloop=yes animoverlay printerpath=gif animation=start nodate nonumber;
ods printer file='~/momwreath/wreath.gif';                        /* Animated GIF filename */
proc sgplot noautolegend aspect=1 noborder nowall pad=0;          /* Generate a wreath! */
by frame;                                                         /* One image per frame to make hearts twinkle */
styleattrs backcolor=bipb;                                        /* Brilliant purple background color */
symbolchar name=uniHeart char='2764'x;                             /* Unicode value for heart */
scatter x=x y=y / markerattrs=(symbol=uniHeart size=19pt) colormodel=(cXdda0dd cX87ceeb cX40e0D0 cXfff700 cX00ff7f cXbdfcc9 cXffc0cb cXffa07a cXee82ee cXc8a2c8 cX00cccc cXb573dc) colorresponse=color; * Generate pastel-colored hearts;
text x=tx y=ty text=msg / contributeoffsets=none textattrs=(size=30pt weight=bold color=white) splitchar='*' splitpolicy=splitalways contributeoffsets=none; * "Happy Mother's Day!" message;
xaxis display=none; yaxis display=none;                           /* Hide axes */
run;
options printerpath=gif animation=stop;                           /* Stop recording images */
ods printer close;

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 0 replies
  • 1023 views
  • 5 likes
  • 1 in conversation