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

veteransday2025.png

 

Happy Veterans Day to all who serve and protect our freedom!

 

* Fun With SAS ODS Graphics: Veterans Day
  Images from en.wikipedia.org/wiki/United_States_Department_of_Defense
              en.wikipedia.org/wiki/United_States_Department_of_Veterans_Affairs;

data services;                     * Generate x/y points for services logos/emblems;
input image : $255.;               * Read image names, images are in ~/vets directory;
image='/home/ted.conway/vets/'||image;
if 1<=_n_<=6 then do;              * Distribute images for the 6 armed services branches over a unit circle (angles in radians); 
  x=cos((_n_-1)*(60/360)*2*constant('pi')*1); 
  y=sin((_n_-1)*(60/360)*2*constant('pi')*1); 
  output;
  end;
else do;                           * Display Veterans Affairs logo/emblem in center;
  x=0; 
  y=0;
  output;
  end;                             * List of names of logo/emblem image files (images from Wikipedia);
datalines;
512px-Mark_of_the_United_States_Army.svg.png
512px-Emblem_of_the_United_States_Marine_Corps.svg.png
512px-Emblem_of_the_United_States_Navy.svg.png
512px-U.S._Air_Force_service_mark.svg.png
512px-Seal_of_the_United_States_Space_Force.svg.png
512px-Seal_of_the_United_States_Coast_Guard.svg.png
512px-Seal_of_the_U.S._Department_of_Veterans_Affairs.svg.png
;
data images;                        * Use SAS-provided macros to create annotate dataset to position/size images;
set services;
%SGANNO;                            
%SGIMAGE (image=IMAGE,drawspace="datavalue",imagescale="fitheight",x1=X,y1=Y,height=.75,heightunit="DATA",anchor="CENTER");
                                    * Generate chart of connected logos/emblems (Annotated with images Vector+Ellipseparm chart);
ods graphics / reset noborder width=9in height=9in imagefmt=svg;
proc sgplot data=services aspect=1 nowall noborder noautolegend sganno=images;
styleattrs backcolor=skyblue;
inset "THANK YOU" / textattrs=(weight=bold size=24pt) position=top;
inset "FOR YOUR SERVICE" / textattrs=(weight=bold size=22pt) position=bottom;
ellipseparm semimajor=1 semiminor=1 / outline lineattrs=(color=black thickness=3pt); * Connect outer logos/emblems to each other with a circle;          
vector x=x y=y / noarrowheads lineattrs=(color=black thickness=4pt); * Connecct outer logos/emblems to center with lines;
xaxis display=none values=(-1.475 1.475) offsetmin=0 offsetmax=0; * Suppress axes;
yaxis display=none values=(-1.475 1.475) offsetmin=0 offsetmax=0;
ellipseparm semimajor=3 semiminor=3; * 'Dummy' circle outside of bounds to make x/y scales consistent;  
run;
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
  • 441 views
  • 4 likes
  • 1 in conversation