<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Fun with SAS ODS Graphics: New Year's Eve 4-Bit Boolean Ball Drop (Animated GIF Bubble Chart) in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-New-Year-s-Eve-4-Bit-Boolean-Ball-Drop/m-p/851678#M23388</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="countdown.gif" style="width: 480px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78949i2E4CEEF383560AAF/image-size/large?v=v2&amp;amp;px=999" role="button" title="countdown.gif" alt="countdown.gif" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a "New Year's Eve Ball Drop" inspired by the blinking lights that graced the &lt;A href="https://en.wikipedia.org/wiki/Front_panel" target="_self"&gt;front panels of vintage computers&lt;/A&gt;. Happy New Year, all!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Fun w/SAS ODS Graphics: New Year's Eve 4-Bit Boolean Ball Drop (Animated GIF Bubble Chart);

data lights;                                                       /* Generate "vintage computer front panel lights" */  
retain size 1;                                                     /* All lights are same size */
do frame=10 to 0 by -1;                                            /* Need a 10-second NYE countdown */
  do y=10 to 0 by -1;                                              
    lights=put(y,binary4.);                                        /* Convert seconds counter to string of 1's and 0's */ 
    do x=1 to 4;                 
      color=((frame=y) &amp;amp; (substr(lights,x,1)='1'));                /* Turn on lights on/off to reflect # of seconds left */
      output;
    end;
  end;  
end;
  
%macro genframes;                                                  /* Generate frames for NYE ball drop countdown animation */
%do frame=10 %to 0 %by -1;                                         /* One frame for each second */
options animduration= %if &amp;amp;frame=10 or &amp;amp;frame=0 %then 2; %else 1;; /* Display first and last frames for 2 seconds, all other for 1 second */
%if &amp;amp;frame&amp;gt;0 %then %let year=2022; %else %let year=2023;           /* Change year from 2022 to 2023 on last frame */
proc sgplot data=lights(where=(frame=&amp;amp;frame)) noautolegend aspect=1.25 noborder nowall pad=0 subpixel; /* Generate countdown! */
styleattrs backcolor=black;                                        /* Midnight black background */
bubble x=x y=y size=size / fill                                    /* Generate on (red) and off (black) lights */
       dataskin=pressed nooutline colormodel=(black red) colorresponse=color bradiusmin=.14in bradiusmax=.15in; 
xaxis display=(nolabel noline noticks) values=(.75 1 2 3 4 4.25) valuesdisplay=(" " "8" "4" "2" "1" " ") valueattrs=(color=white weight=bold); /* Display powers of 2 on x-axis */ 
yaxis display=(noline noticks) label="&amp;amp;year" values=(10 to 0 by -1) labelattrs=(color=white weight=bold size=72pt) valueattrs=(color=white weight=bold);  /* Display year and seconds on y-axis */
run;
%end;
%mend;

ods graphics / imagefmt=GIF width=5in height=5in antialias;       /* Record images */  
options papersize=('5 in', '5 in') animduration=2 animloop=yes animoverlay printerpath=gif animation=start nodate nonumber;
ods printer file='~/newyear/countdown.gif';                       /* Animated GIF filename */
%genframes;                                                       /* Generate frames */
options printerpath=gif animation=stop;                           /* Stop recording images */
ods printer close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="By superde1uxe - https://www.flickr.com/photos/superde1uxe/1914344040/sizes/o/, CC BY 2.0, https://commons.wikimedia.org/w/index.php?curid=7579435" style="width: 800px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78950i8F4FA02F5367797F/image-size/large?v=v2&amp;amp;px=999" role="button" title="IMSAI8080.jpg" alt="By superde1uxe - https://www.flickr.com/photos/superde1uxe/1914344040/sizes/o/, CC BY 2.0, https://commons.wikimedia.org/w/index.php?curid=7579435" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;By superde1uxe - https://www.flickr.com/photos/superde1uxe/1914344040/sizes/o/, CC BY 2.0, https://commons.wikimedia.org/w/index.php?curid=7579435&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 31 Dec 2022 08:31:33 GMT</pubDate>
    <dc:creator>tc</dc:creator>
    <dc:date>2022-12-31T08:31:33Z</dc:date>
    <item>
      <title>Fun with SAS ODS Graphics: New Year's Eve 4-Bit Boolean Ball Drop (Animated GIF Bubble Chart)</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-New-Year-s-Eve-4-Bit-Boolean-Ball-Drop/m-p/851678#M23388</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="countdown.gif" style="width: 480px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78949i2E4CEEF383560AAF/image-size/large?v=v2&amp;amp;px=999" role="button" title="countdown.gif" alt="countdown.gif" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a "New Year's Eve Ball Drop" inspired by the blinking lights that graced the &lt;A href="https://en.wikipedia.org/wiki/Front_panel" target="_self"&gt;front panels of vintage computers&lt;/A&gt;. Happy New Year, all!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Fun w/SAS ODS Graphics: New Year's Eve 4-Bit Boolean Ball Drop (Animated GIF Bubble Chart);

data lights;                                                       /* Generate "vintage computer front panel lights" */  
retain size 1;                                                     /* All lights are same size */
do frame=10 to 0 by -1;                                            /* Need a 10-second NYE countdown */
  do y=10 to 0 by -1;                                              
    lights=put(y,binary4.);                                        /* Convert seconds counter to string of 1's and 0's */ 
    do x=1 to 4;                 
      color=((frame=y) &amp;amp; (substr(lights,x,1)='1'));                /* Turn on lights on/off to reflect # of seconds left */
      output;
    end;
  end;  
end;
  
%macro genframes;                                                  /* Generate frames for NYE ball drop countdown animation */
%do frame=10 %to 0 %by -1;                                         /* One frame for each second */
options animduration= %if &amp;amp;frame=10 or &amp;amp;frame=0 %then 2; %else 1;; /* Display first and last frames for 2 seconds, all other for 1 second */
%if &amp;amp;frame&amp;gt;0 %then %let year=2022; %else %let year=2023;           /* Change year from 2022 to 2023 on last frame */
proc sgplot data=lights(where=(frame=&amp;amp;frame)) noautolegend aspect=1.25 noborder nowall pad=0 subpixel; /* Generate countdown! */
styleattrs backcolor=black;                                        /* Midnight black background */
bubble x=x y=y size=size / fill                                    /* Generate on (red) and off (black) lights */
       dataskin=pressed nooutline colormodel=(black red) colorresponse=color bradiusmin=.14in bradiusmax=.15in; 
xaxis display=(nolabel noline noticks) values=(.75 1 2 3 4 4.25) valuesdisplay=(" " "8" "4" "2" "1" " ") valueattrs=(color=white weight=bold); /* Display powers of 2 on x-axis */ 
yaxis display=(noline noticks) label="&amp;amp;year" values=(10 to 0 by -1) labelattrs=(color=white weight=bold size=72pt) valueattrs=(color=white weight=bold);  /* Display year and seconds on y-axis */
run;
%end;
%mend;

ods graphics / imagefmt=GIF width=5in height=5in antialias;       /* Record images */  
options papersize=('5 in', '5 in') animduration=2 animloop=yes animoverlay printerpath=gif animation=start nodate nonumber;
ods printer file='~/newyear/countdown.gif';                       /* Animated GIF filename */
%genframes;                                                       /* Generate frames */
options printerpath=gif animation=stop;                           /* Stop recording images */
ods printer close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="By superde1uxe - https://www.flickr.com/photos/superde1uxe/1914344040/sizes/o/, CC BY 2.0, https://commons.wikimedia.org/w/index.php?curid=7579435" style="width: 800px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78950i8F4FA02F5367797F/image-size/large?v=v2&amp;amp;px=999" role="button" title="IMSAI8080.jpg" alt="By superde1uxe - https://www.flickr.com/photos/superde1uxe/1914344040/sizes/o/, CC BY 2.0, https://commons.wikimedia.org/w/index.php?curid=7579435" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;By superde1uxe - https://www.flickr.com/photos/superde1uxe/1914344040/sizes/o/, CC BY 2.0, https://commons.wikimedia.org/w/index.php?curid=7579435&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 31 Dec 2022 08:31:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-New-Year-s-Eve-4-Bit-Boolean-Ball-Drop/m-p/851678#M23388</guid>
      <dc:creator>tc</dc:creator>
      <dc:date>2022-12-31T08:31:33Z</dc:date>
    </item>
  </channel>
</rss>

