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

Valentines.gif

 

Happy Valentine's Day!

 

* Fun w/SAS ODS Graphics: Be Still My Unicode Valentine Heart;

data heart;                                 /* Plot Unicode hearts of various sizes at x=0 y=-.025 */
xH=0; yH=-.025; txtH=unicode('\u2764');     /* Unicode heart character code is hex 2764 */

ods _all_ close;                            /* Plot valentine (animated GIF with 5 frames) */
options papersize=('5 in', '5 in') printerpath=gif animation=start animloop=YES NOANIMOVERLAY nodate nonumber;
ods printer file='/home/ted.conway/Valentines.gif';
ods graphics / width=5in height=5in imagefmt=GIF antialias; 
%macro valentine;                           
%do frame=0 %to 4;                          /* Plot 5 nested Valentine hearts of varying sizes */ 
%if &frame=0 | &frame=4 %then options animduration=.75; %else  options animduration=.25;; 
proc sgplot data=heart noautolegend noborder pad=0 aspect=1 nowall subpixel;
styleattrs backcolor=cxffbcd9;              /* Cotton candy pink background */
inset " " "HAPPY VALENTINE'S DAY!" / position=top textattrs=(size=22pt color=cxB81B47 weight=bold); /* Bright marooon color */
%do h=&frame %to 0 %by-1;                   /* Plot biggest hearts first, alternate red and white color */
text x=xH y=yH text=txtH / textattrs=(family="Arial Unicode MS" size=%eval((&h=0)*36+36*&h*5/2)pt color=%if %sysfunc(mod(&h,2))=1 %then WHITE; %else RED;) position=center vcenter=bbox contributeoffsets=none strip;; 
%end;
xaxis display=none offsetmin=0 offsetmax=0 values=(-1 1); /* Suppress labels/ticks on axes, set bounds */
yaxis display=none offsetmin=0 offsetmax=0 values=(-1 1);
run;
%end;
%mend;

%valentine;
options printerpath=gif animation=stop;
ods printer close;
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
  • 1131 views
  • 7 likes
  • 1 in conversation