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

 

bracelet.png

 

Happy Mother's Day, all!

 

* Fun w/SAS ODS Graphics: Mom Bracelet;

data beads;                      * Create "beads" for Mom bracelet;
retain size 1;                   * All beads same size;
pi=constant("pi");               * 3.414...;
do i=1 to 20;                    * Plot 20 points around circle (see blogs.sas.com/content/graphicallyspeaking/2018/11/01/text-plot-can-do-that/);
  angle=90-i*18;
  x=cos(angle*pi/180);
  y=sin(angle*pi/180);
  angle=angle+90;                * Add 90 to angle to rotate letter labels at bottom back upright;
  if i in (9, 11) then txt="M";  * Add letters 'M' in beads 9 and 11 for 'MOM' (counting from top and going clockwise);
  if i=10 then yH=y;             * Need a point to plot a heart in bead 10 (instead of the 'O' in 'MOM'); 
  output;
  yh=.; txt="";                  * Reset variables;
end;
                                 * Let's plot the bracelet! (Ellipse + Bubble + Text Plots);
ods graphics / width=5.5in height=5.5in antialias noborder; 
proc sgplot data=beads noautolegend noborder pad=0 aspect=1 nowall subpixel noborder pad=0;
styleattrs backcolor=cxfff9ff;   * Very light pink background;              
symbolimage name=heart image='/home/ted.conway/heart.png'; * Use white heart image for the 'O' in 'MOM';
ellipseparm semimajor=1 semiminor=1 / slope=0 xorigin=0 yorigin=0 outline lineattrs=(color=vipk thickness=3pt); * 'Elastic' to string beads;
bubble x=x y=y size=size / fill fillattrs=(color=stpk) nooutline bradiusmin=30 bradiusmax=31 dataskin=gloss; * Beads;
text x=x y=y text=txt / rotate=angle contributeoffsets=none strip textattrs=(color=white size=26pt weight=bold); * Plot 'M' letters in 'MOM' at an angle;                           
scatter x=x y=yH / markerattrs=(symbol=heart size=32pt); * Plot heart image (takes place of 'O' in 'MOM');                           
xaxis display=none offsetmin=0 offsetmax=0 values=(-1.3 1.3); * Suppress labels/ticks on axes, set bounds;
yaxis display=none offsetmin=0 offsetmax=0 values=(-1.3 1.3);
run;

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 0 replies
  • 585 views
  • 3 likes
  • 1 in conversation