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

squarecirclesvalentine.png

 

Tired: Say It With Flowers. Wired: Say It With Geometry. 😀 Happy Valentine's Day!

 

* Fun With SAS ODS Graphics: Square + Circles Valentine;

data points;                                       * Generate points for square (polygon) and 2 circles (ellipses);                                          
retain polygon 1;
xs=-cos(constant("pi")/4); ys=0; output;           * 1 square, sides of length 1, rotated 45 degrees; 
xs=0; ys=sin(constant("pi")/4); output; 
xs=cos(constant("pi")/4); ys=0; output;     
xs=0; ys=-sin(constant("pi")/4); output; 
xs=.; group=1;                                     * 2 circles, diameter 1, centered on top left/right sides of square;  
x=-cos(constant("pi")/4)/2; y=sin(constant("pi")/4)/2; output; x=-x; output; 

ods graphics / width=5in height=5in;
proc sgplot aspect=1 noautolegend nowall noborder; * Draw valentine (1 square + 2 circles);
styleattrs backcolor=lightpink;
inset "HAPPY VALENTINE'S DAY!" / position=bottom textattrs=(color=cxC00000 weight=bold size=18pt);
polygon x=xs y=ys id=polygon / fill fillattrs=(color=cxC00000) transparency=.0 outline 
             lineattrs=(color=cxC00000 thickness=3pt) transparency=.5;
ellipseparm semimajor=.5 semiminor=.5 / xorigin=x yorigin=y group=group nomissinggroup 
            outline lineattrs=(color=cxC00000 thickness=3pt) xorigin=x yorigin=y  
            fill fillattrs=(color=cxC00000) transparency=.5;
xaxis display=none values=(-.9 .9);
yaxis display=none values=(-.9 .9);
run;
1 REPLY 1
Jay54
Meteorite | Level 14
Very nice, TC. Happy to learn the heart shape could be built using three simple primitives.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 1 reply
  • 798 views
  • 6 likes
  • 2 in conversation