<?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: &amp;quot;Happy New Year!&amp;quot; Film Leader Countdown in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-quot-Happy-New-Year-quot-Film-Leader/m-p/614308#M19265</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Happy New Year! (note: GIF compressed with compressor.io)" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/35073i56BB7A47B2394F9E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="filmlead-compressor.gif" alt="Happy New Year! (note: GIF compressed with compressor.io)" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Happy New Year! (note: GIF compressed with compressor.io)&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;To mark the new decade, here's a quick-and-dirty SAS ODS Graphics take on a &lt;A href="https://en.wikipedia.org/wiki/Film_leader" target="_self"&gt;film leader&lt;/A&gt; countdown. Happy New Year, all!&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: "Happy New Year!" Film Countdown Leader (see en.wikipedia.org/wiki/Film_leader);

data points(keep=counter angle text x y tx ty vx vy);      * Counter=10, 9, ..., 1;
pi=constant('pi');                                         * Angle=degrees of slices (0 to 360 by 15);
retain tx ty 0;                                            * x/y=Polygon coordinates, tx/ty=text, vx/vy=vector;
do counter=10 to 1 by -1;                                  * Countdown seconds, 10 to 1;
  text=put(counter,2.);                                    * Format econds remaining;
  do angle=0 to 360 by 15;                                 * Plot every 15 degrees beginning at top;
    StartRadians=90/360*2*pi-angle/360*2*pi;               * Convert radians to x/y points for plotting;
    vx=cos(StartRadians)*2; vy=sin(startradians)*2;        * Last polygon point x/y coordinates;
    x=0; y=0; output;                                      * Start drawing shaded polygon at center (0,0);
    do i=0 to angle by 1;                                  * Add more points to shaded plygon (one point/degree);
      StartRadians=90/360*2*pi-i/360*2*pi;                 * Convert radians to x/y points for plotting;
      x=cos(StartRadians)*2; y=sin(startradians)*2;        * Polygon point x/y coordinates;
      output;
    end;
  end;
end;
run;
 
options nobyline;                                          
proc template;                                             * Film countdown leader chart definition;
define statgraph filmtemplate;                             * Composite of scatter, polygon, vector, ellipse, text plots;
  begingraph / pad=0;
    layout overlayequated /  
      equatetype=square pad=0 border=false
      walldisplay=none backgroundcolor=lightgrey opaque=true 
      commonaxisopts=(tickvaluelist=(-1 1) viewmin=-1 viewmax=1) /* Cutoff window at -1 and 1 to trim" polygon area */
      xaxisopts=(display=none offsetmin=0.000 offsetmax=0.000 viewmin=-1 viewmax=1)  /* Suppress axes/ticks/values */
      yaxisopts=(display=none offsetmin=0.000 offsetmax=0.000 viewmin=-1 viewmax=1);
      scatterplot x=x y=y / markerattrs=(size=0); * Ensure at least some data is plotted;
      polygonplot x=x y=y id=angle / fillattrs=(color=gray) display=(fill) label=none; * Shaded "radar sweep" area;
      vectorplot x=vx y=vy xorigin=0 yorigin=0 / arrowheads=false lineattrs=(color=black thickness=4pt); * "Radar sweep" hand; 
      referenceline x=0 / lineattrs=(color=black thickness=4pt); * Line bisecting x axis;
      referenceline y=0 / lineattrs=(color=black thickness=4pt); * Line bisecting y axis;      
      ellipseparm semimajor=.92 semiminor=.92 xorigin=0 yorigin=0 slope=0 / outlineattrs=(color=white thickness=8pt); * Outer circle;
      ellipseparm semimajor=.77 semiminor=.77 xorigin=0 yorigin=0 slope=0 / outlineattrs=(color=white thickness=8pt); * Inner circle;  
      textplot x=tx y=ty text=text / textattrs=(size=216pt color=black weight=bold) strip=true contributeoffsets=none; * Seconds remaining;
    endlayout;
  endgraph;
end;
run;
                                                           * Create animated GIF film countdown leader followed by Happy New Year! message;
ods _all_ close;                                           * Animated GIF setup;
options papersize=('5 in', '5 in') printerpath=gif animation=start 
        nodate nonumber animloop=YES NOANIMOVERLAY;
ods printer file='/folders/myfolders/filmlead.gif';
ods graphics / width=5in height=5in imagefmt=GIF;

options animduration=.04;                                   * 25 frames per second;
proc sgrender data=points template=filmtemplate;            * Generate countdown frames using BY statement;
by descending counter angle;                                
run;

data year;                                                  * Text for Happy New Year message;
retain tx ty 0 msg "2020" tx2 0 ty2 .9 msg2 "HAPPY NEW YEAR!";

options animduration=2;                                     * Generate Happy New Year! message frame (2 seconds);
proc sgplot data=year aspect=1 noborder opaque nowall noautolegend;
styleattrs backcolor=black;
text x=tx y=ty text=msg / textattrs=(size=128pt color=white weight=bold) contributeoffsets=none;
text x=tx2 y=ty2 text=msg2 / textattrs=(size=30pt color=white weight=bold) contributeoffsets=none position=bottom;
xaxis display=none values=(-1 0 1); yaxis display=none values=(-1 0 1);
run;

options printerpath=gif animation=stop;                     * Animated GIF wrapup;
ods printer close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 29 Dec 2019 20:30:50 GMT</pubDate>
    <dc:creator>tc</dc:creator>
    <dc:date>2019-12-29T20:30:50Z</dc:date>
    <item>
      <title>Fun With SAS ODS Graphics: "Happy New Year!" Film Leader Countdown</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-quot-Happy-New-Year-quot-Film-Leader/m-p/614308#M19265</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Happy New Year! (note: GIF compressed with compressor.io)" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/35073i56BB7A47B2394F9E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="filmlead-compressor.gif" alt="Happy New Year! (note: GIF compressed with compressor.io)" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Happy New Year! (note: GIF compressed with compressor.io)&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;To mark the new decade, here's a quick-and-dirty SAS ODS Graphics take on a &lt;A href="https://en.wikipedia.org/wiki/Film_leader" target="_self"&gt;film leader&lt;/A&gt; countdown. Happy New Year, all!&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: "Happy New Year!" Film Countdown Leader (see en.wikipedia.org/wiki/Film_leader);

data points(keep=counter angle text x y tx ty vx vy);      * Counter=10, 9, ..., 1;
pi=constant('pi');                                         * Angle=degrees of slices (0 to 360 by 15);
retain tx ty 0;                                            * x/y=Polygon coordinates, tx/ty=text, vx/vy=vector;
do counter=10 to 1 by -1;                                  * Countdown seconds, 10 to 1;
  text=put(counter,2.);                                    * Format econds remaining;
  do angle=0 to 360 by 15;                                 * Plot every 15 degrees beginning at top;
    StartRadians=90/360*2*pi-angle/360*2*pi;               * Convert radians to x/y points for plotting;
    vx=cos(StartRadians)*2; vy=sin(startradians)*2;        * Last polygon point x/y coordinates;
    x=0; y=0; output;                                      * Start drawing shaded polygon at center (0,0);
    do i=0 to angle by 1;                                  * Add more points to shaded plygon (one point/degree);
      StartRadians=90/360*2*pi-i/360*2*pi;                 * Convert radians to x/y points for plotting;
      x=cos(StartRadians)*2; y=sin(startradians)*2;        * Polygon point x/y coordinates;
      output;
    end;
  end;
end;
run;
 
options nobyline;                                          
proc template;                                             * Film countdown leader chart definition;
define statgraph filmtemplate;                             * Composite of scatter, polygon, vector, ellipse, text plots;
  begingraph / pad=0;
    layout overlayequated /  
      equatetype=square pad=0 border=false
      walldisplay=none backgroundcolor=lightgrey opaque=true 
      commonaxisopts=(tickvaluelist=(-1 1) viewmin=-1 viewmax=1) /* Cutoff window at -1 and 1 to trim" polygon area */
      xaxisopts=(display=none offsetmin=0.000 offsetmax=0.000 viewmin=-1 viewmax=1)  /* Suppress axes/ticks/values */
      yaxisopts=(display=none offsetmin=0.000 offsetmax=0.000 viewmin=-1 viewmax=1);
      scatterplot x=x y=y / markerattrs=(size=0); * Ensure at least some data is plotted;
      polygonplot x=x y=y id=angle / fillattrs=(color=gray) display=(fill) label=none; * Shaded "radar sweep" area;
      vectorplot x=vx y=vy xorigin=0 yorigin=0 / arrowheads=false lineattrs=(color=black thickness=4pt); * "Radar sweep" hand; 
      referenceline x=0 / lineattrs=(color=black thickness=4pt); * Line bisecting x axis;
      referenceline y=0 / lineattrs=(color=black thickness=4pt); * Line bisecting y axis;      
      ellipseparm semimajor=.92 semiminor=.92 xorigin=0 yorigin=0 slope=0 / outlineattrs=(color=white thickness=8pt); * Outer circle;
      ellipseparm semimajor=.77 semiminor=.77 xorigin=0 yorigin=0 slope=0 / outlineattrs=(color=white thickness=8pt); * Inner circle;  
      textplot x=tx y=ty text=text / textattrs=(size=216pt color=black weight=bold) strip=true contributeoffsets=none; * Seconds remaining;
    endlayout;
  endgraph;
end;
run;
                                                           * Create animated GIF film countdown leader followed by Happy New Year! message;
ods _all_ close;                                           * Animated GIF setup;
options papersize=('5 in', '5 in') printerpath=gif animation=start 
        nodate nonumber animloop=YES NOANIMOVERLAY;
ods printer file='/folders/myfolders/filmlead.gif';
ods graphics / width=5in height=5in imagefmt=GIF;

options animduration=.04;                                   * 25 frames per second;
proc sgrender data=points template=filmtemplate;            * Generate countdown frames using BY statement;
by descending counter angle;                                
run;

data year;                                                  * Text for Happy New Year message;
retain tx ty 0 msg "2020" tx2 0 ty2 .9 msg2 "HAPPY NEW YEAR!";

options animduration=2;                                     * Generate Happy New Year! message frame (2 seconds);
proc sgplot data=year aspect=1 noborder opaque nowall noautolegend;
styleattrs backcolor=black;
text x=tx y=ty text=msg / textattrs=(size=128pt color=white weight=bold) contributeoffsets=none;
text x=tx2 y=ty2 text=msg2 / textattrs=(size=30pt color=white weight=bold) contributeoffsets=none position=bottom;
xaxis display=none values=(-1 0 1); yaxis display=none values=(-1 0 1);
run;

options printerpath=gif animation=stop;                     * Animated GIF wrapup;
ods printer close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 29 Dec 2019 20:30:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-quot-Happy-New-Year-quot-Film-Leader/m-p/614308#M19265</guid>
      <dc:creator>tc</dc:creator>
      <dc:date>2019-12-29T20:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: Fun With SAS ODS Graphics: "Happy New Year!" Film Leader Countdown</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-quot-Happy-New-Year-quot-Film-Leader/m-p/614769#M19270</link>
      <description>&lt;P&gt;Very cool &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2020 15:10:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-quot-Happy-New-Year-quot-Film-Leader/m-p/614769#M19270</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2020-01-02T15:10:14Z</dc:date>
    </item>
  </channel>
</rss>

