Graphics Programming

Data visualization using SAS programming, including ODS Graphics and SAS/GRAPH. Charts, plots, maps, and more!
BookmarkSubscribeRSS Feed
tc
Lapis Lazuli | Level 10 tc
Lapis Lazuli | Level 10

Ellipses Easter EggEllipses Easter Egg

Drawing an egg could involve a lot of math...or you can cut a few corners and join the top of an ellipse with the bottom of a circle. Happy Easter, all!

 

* Fun With SAS ODS Graphics: Ellipses Easter Egg
  Bunny icon courtesy of Marie-Louise Merser, DK thenounproject.com/search/?q=easter+bunny&i=960660;

data egg;                                                            * Generate points and text for Easter Egg;
retain id 0 xt1 0 yt1 .195 text1 'HAPPY' xt2 0 yt2 0 text2 'Easter' xb 0 yb -.375; * Text to display and x/y points;
x=-1; y=0; output; x=1; output; y=-1; output; x=-1; output;          * Rectangle points (used to mask bottom half of top ellipse);

ods graphics / reset antialias width=5in height=5in;
proc sgplot data=egg aspect=1 noborder noautolegend nowall;          * Generate Easter Egg (half-ellipse + masking polygon + circle + text + scatter plots);
symbolimage name=bunny image='/folders/myfolders/easterbunny.png';   * Rabbit icon; 
ellipseparm semimajor=.75 semiminor=1 / nooutline fill fillattrs=(color=purple);* Top ellipse of Easter Egg;
polygon x=x y=y id=id / nooutline fill fillattrs=(color=white);      * Mask off bottom half of top ellipse;
ellipseparm semimajor=.75 semiminor=.75  / nooutline fill fillattrs=(color=purple);* Bottom ellipse of Easter Egg (circle);
text x=xt1 y=yt1 text=text1 / textattrs=(color=white size=18pt);     * Happy; 
text x=xt2 y=yt2 text=text2 / textattrs=(color=white size=63pt);     * Easter; 
scatter x=xb y=yb / markerattrs=(symbol=bunny size=48pt);            * Easter Bunny image; 
xaxis display=none min=-.925 max=.925 offsetmax=.001 offsetmin=.001; * Limit x/y axis bounds;
yaxis display=none min=-.80 max=1.05 offsetmax=.001 offsetmin=.001;

 

Ellipses Easter Egg "Wireframe"Ellipses Easter Egg "Wireframe"

 

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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