<?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 Re: Fun With SAS ODS Graphics, July 4th Edition in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/571122#M18409</link>
    <description>&lt;P&gt;With reflections!&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="j4.gif" style="width: 576px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30746iEA6FF18ED85C00EB/image-size/large?v=v2&amp;amp;px=999" role="button" title="j4.gif" alt="j4.gif" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Fun with GTL vectorplots, 4th of July animated GIF "fireworks";

data f;                * Generate points for fireworks;
pi=constant('pi');
do firework=1 to 7;            * Seven fireworks "explosions";
  r=.2+ranuni(2)*.3;           * Random radius between .2 and .5;
  if firework=7 then r=.5;     * Big finish! (radius=.5);
  xo=r+ranuni(4)*(1-r*2);      * Random origin (x, y);
  yo=r+ranuni(6)*(1-r*2)/3+.3;
  do a=0 to 352.5 by 7.5;      * Line every 7.5 degrees;
    x=r*cos(a*pi/180)+xo;      * Calc x and y coordinates for fully-exploded fireworks;
    y=r*sin(a*pi/180)+yo;
    xi1=.01*cos(a*pi/180)+xo;  * Initial unexploded x, y points (r=.01, .02);
    yi1=.01*sin(a*pi/180)+yo;
    xi2=.02*cos(a*pi/180)+xo;
    yi2=.02*sin(a*pi/180)+yo;

    *reflection;
    waterline=.4;
    h=yo-waterline;                                                  
    yyo=yo-h*2;  yy=y-h*2;
          
    *clip low Y;
    newy=max(y,waterline); 
    ratio=coalesce(divide(y-yo,newy-yo),1); x=xo+(x-xo)/ratio;  y=newy; 

    output;
  end;
end;

data empty;                    * Generate out-of-frame points to create "empty" frame;
  retain x y xo yo yy yyo -1 ;
run;

ods _all_ close;               * Use generated points to produce animated GIF;
options papersize=('6 in', '6 in') printerpath=gif animation=start 
        nodate nonumber animduration=.1 animloop=YES NOANIMOVERLAY;
ods printer file="%sysfunc(pathname(WORK))\j4.gif";
ods graphics / border=off width=6in height=6in imagefmt=GIF;

%macro fireworks;              * Vector plot (change pattern to "fade" fireworks;
%macro modtemplate(pattern=);
proc template;
define statgraph vectorplot;
begingraph ;
  layout overlayequated / equatetype=square walldisplay=(fill) wallcolor=cx222222 
          commonaxisopts=(viewmin=0 viewmax=1) xaxisopts=(display=none) yaxisopts=(display=none);
  vectorplot y=y x=x xorigin=xo yorigin=yo / 
             arrowheads=false lineattrs=(pattern=&amp;amp;pattern. color=&amp;amp;linecolor. thickness=1.6pt);
  annotate / id="chicago";  
  vectorplot y=yy x=x xorigin=xo yorigin=yyo / 
             arrowheads=false lineattrs=(pattern=&amp;amp;pattern. color=&amp;amp;linecolor2. thickness=1.6pt);
  endlayout;
endgraph;
end;
run;
%mend;

%do f=1 %to 7;                  * Generate frames for animated GIF;
   %let linecolor=%scan(hotpink orange dodgerblue yellow lime white red, &amp;amp;f); 
   %let linecolor2=%scan(verydarkpurple verydarkorange verydarkblue verydarkyellow verydarkgreen verydarkgrey verydarkred, &amp;amp;f); 
   %modtemplate(pattern=solid); * Initial unexploded frames (2 frames);
   proc sgrender data=f(where=(firework=&amp;amp;f.) drop=x y rename=(xi1=x yi1=y)) template=vectorplot sganno=chicago;
   proc sgrender data=f(where=(firework=&amp;amp;f.) drop=x y rename=(xi2=x yi2=y)) template=vectorplot sganno=chicago;
   %modtemplate(pattern=solid);
   %do i=1 %to 5;               * Fully exploded frames (5 frames);
     proc sgrender data=f(where=(firework=&amp;amp;f.)) template=vectorplot sganno=chicago; 
   %end;                        * Fading/empty frames (3 frames);
   %modtemplate(pattern=shortdashdot);
   proc sgrender data=f(where=(firework=&amp;amp;f.)) template=vectorplot sganno=chicago;
   %modtemplate(pattern=dot);
   proc sgrender data=f(where=(firework=&amp;amp;f.)) template=vectorplot sganno=chicago;
   proc sgrender data=empty template=vectorplot sganno=chicago;
%end;
run; 
%mend;

data chicago ;                  * Image of Chicago skyline;
  retain function "Image" anchor "bottomleft" x1 0 y1 0 width 100 height 100
         widthunit 'percent' heightunit 'percent' imagescale  'fit'
         drawspace "layoutpercent" layer 'fore' 
         id 'chicago' Image "%sysfunc(pathname(WORK))\ch2.png";
run;                

%fireworks;                     * Light 'em up!; 
options printerpath=gif animation=stop;
ods printer close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="the image with a transparent color" style="width: 505px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30747iFE8E12456E3D676C/image-size/large?v=v2&amp;amp;px=999" role="button" title="ch2.png" alt="the image with a transparent color" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;the image with a transparent color&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>Thu, 04 Jul 2019 03:37:03 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2019-07-04T03:37:03Z</dc:date>
    <item>
      <title>Fun With SAS ODS Graphics, July 4th Edition</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/281636#M9973</link>
      <description>&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3875i3D9C50CA44C8FA9D/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="fourthofjuly.gif" title="fourthofjuly.gif" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OK, animated GIF GTL vector plots admittedly are not nearly as fun as the firecrackers of my youth, but at least I'll still have all my fingers at the end of the day!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Acknowledgements: If some of the code/concepts look&amp;nbsp;familiar to readers of Sanjay Matange's &lt;EM&gt;&lt;A href="http://blogs.sas.com/content/graphicallyspeaking/" target="_self"&gt;Graphically Speaking&lt;/A&gt;&lt;/EM&gt; blog posts on some real use cases for &lt;A href="http://blogs.sas.com/content/graphicallyspeaking/2012/04/09/simpler-is-better/" target="_self"&gt;vector plots&lt;/A&gt; and &lt;A href="http://blogs.sas.com/content/graphicallyspeaking/2013/05/23/animation-using-sgplot/" target="_self"&gt;animated plots&lt;/A&gt;, it's no coincidence&amp;nbsp;(bugs/kludges are my own!).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;SAS CODE&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;* Fun with GTL vectorplots, 4th of July animated GIF "fireworks";

data fireworks;                * Generate points for fireworks;
pi=constant('pi');
do firework=1 to 7;            * Seven fireworks "explosions";
  r=.2+ranuni(2)*.3;           * Random radius between .2 and .5;
  if firework=7 then r=.5;     * Big finish! (radius=.5);
  xo=r+ranuni(4)*(1-r*2);      * Random origin (x, y);
  yo=r+ranuni(6)*(1-r*2);
  do a=0 to 352.5 by 7.5;      * Line every 7.5 degrees;
    x=r*cos(a*pi/180)+xo;      * Calc x and y coordinates for fully-exploded fireworks;
    y=r*sin(a*pi/180)+yo;
    xi1=.01*cos(a*pi/180)+xo;  * Initial unexploded x, y points (r=.01, .02);
    yi1=.01*sin(a*pi/180)+yo;
    xi2=.02*cos(a*pi/180)+xo;
    yi2=.02*sin(a*pi/180)+yo;
    output;
  end;
end;

data empty;                    * Generate out-of-frame points to create "empty" frame;
x=-1; y=-1; xo=-1; yo=-1; r=1;
run;

ods _all_ close;               * Use generated points to produce animated GIF;
options papersize=('6 in', '6 in') printerpath=gif animation=start 
        nodate nonumber animduration=.1 animloop=YES NOANIMOVERLAY;
ods printer file='/folders/myfolders/fireworks/fourthofjuly.gif';
ods graphics / border=off width=6in height=6in imagefmt=GIF;

%macro fireworks;              * Vector plot (change pattern to "fade" fireworks;
%macro modtemplate(pattern=);
proc template;
define statgraph vectorplot;
begingraph / opaque=true border=false backgroundcolor=black;
  layout overlayequated / equatetype=square opaque=true border=false backgroundcolor=black 
         wallcolor=black WALLDISPLAY=(FILL) commonaxisopts=(viewmin=0 viewmax=1) 
         xaxisopts=(display=none) yaxisopts=(display=none);
    vectorplot y=y x=x xorigin=xo yorigin=yo / 
               arrowheads=false lineattrs=(pattern=&amp;amp;pattern color=&amp;amp;linecolor thickness=1.6pt);
  endlayout;
endgraph;
end;
run;
%mend;

%do f=1 %to 7;                  * Generate frames for animated GIF;
   data _null_;
   call symput("linecolor",scan("hotpink orange dodgerblue yellow lime white red", &amp;amp;f)); 
   run;
   %modtemplate(pattern=solid); * Initial unexploded frames (2 frames);
   proc sgrender data=fireworks(where=(firework=&amp;amp;f) drop=x y rename=(xi1=x yi1=y)) template=vectorplot;
   proc sgrender data=fireworks(where=(firework=&amp;amp;f) drop=x y rename=(xi2=x yi2=y)) template=vectorplot;
   %modtemplate(pattern=solid);
   %do i=1 %to 5;               * Fully exploded frames (5 frames);
     proc sgrender data=fireworks(where=(firework=&amp;amp;f)) template=vectorplot;
   %end;                        * Fading/empty frames (3 frames);
   %modtemplate(pattern=shortdashdot);
   proc sgrender data=fireworks(where=(firework=&amp;amp;f)) template=vectorplot;
   %modtemplate(pattern=dot);
   proc sgrender data=fireworks(where=(firework=&amp;amp;f)) template=vectorplot;
   proc sgrender data=empty template=vectorplot;
%end;
run; 
%mend;

%fireworks;                     * Light 'em up!; 
options printerpath=gif animation=stop;
ods printer close;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;LINE PATTERNS USED TO SHOW/"FADE" FIREWORKS (SOLID, SHORTDASHDOT, DOT)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3877i8788F40868C41941/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="Fireworks123.gif" title="Fireworks123.gif" /&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 06:54:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/281636#M9973</guid>
      <dc:creator>tc</dc:creator>
      <dc:date>2016-07-01T06:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: Fun With SAS ODS Graphics, July 4th Edition</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/281688#M9974</link>
      <description>&lt;P&gt;I like it! A fun application of animated plots. For another fun example, see &lt;A href="http://blogs.sas.com/content/iml/2014/10/15/game-of-life.html" target="_self"&gt;The Game of Life animation&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One minor comment on the SAS program. &lt;A href="http://blogs.sas.com/content/iml/2012/01/30/random-number-seeds-only-the-first-seed-matters.html" target="_self"&gt;Only the first random number seed is relevant&lt;/A&gt; in your DATA step program. Changing the seed for each call doesn't do anything.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 12:01:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/281688#M9974</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-07-01T12:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: Fun With SAS ODS Graphics, July 4th Edition</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/281704#M9975</link>
      <description>&lt;P&gt;Thanks for the "random tip"!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Up until now, I think my RANUNI needs have been one-statement-per-DATA-step simple.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Like The Game of Life in SAS/IML Studio, too!&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 12:49:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/281704#M9975</guid>
      <dc:creator>tc</dc:creator>
      <dc:date>2016-07-01T12:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: Fun With SAS ODS Graphics, July 4th Edition</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/281708#M9976</link>
      <description>&lt;P&gt;Awesome July 4 firework animation, Ted. &amp;nbsp;Love the way you fade out the light using line patterns. &amp;nbsp;Made my day.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 12:57:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/281708#M9976</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2016-07-01T12:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: Fun With SAS ODS Graphics, July 4th Edition</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/281739#M9977</link>
      <description>&lt;P&gt;That's pretty cool! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 14:49:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/281739#M9977</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2016-07-01T14:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Fun With SAS ODS Graphics, July 4th Edition</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/281754#M9978</link>
      <description>&lt;P&gt;WOW!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had ro comment out &amp;nbsp;opaque=true &amp;nbsp; 'begingraph / &amp;nbsp; /*opaque=true*/ &amp;nbsp;border=false backgroundcolor=black; ".&lt;/P&gt;&lt;P&gt;Ran nicely after that&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Win 7 64 SAS 64 9.4M2&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 15:41:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/281754#M9978</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2016-07-01T15:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: Fun With SAS ODS Graphics, July 4th Edition</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/281757#M9979</link>
      <description>&lt;P&gt;Breathtaking!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May I suggest a tiny tweak? If you were to use mvar or dynamics for the vectorplot statement's pattern= and linecolor=, you can do without the macro modtemplate(). Tweaked code attached.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 15:59:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/281757#M9979</guid>
      <dc:creator>PrashantH_sas</dc:creator>
      <dc:date>2016-07-01T15:59:59Z</dc:date>
    </item>
    <item>
      <title>Take 2: Static B/W image of a GTL vectorplot "fireworks" over downtown Chicago skyline</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/281844#M9988</link>
      <description>&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3895iDE3119E4C98CE2EE/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="Chicago4thJuly.gif" title="Chicago4thJuly.gif" /&gt;&lt;/P&gt;
&lt;P&gt;And with the help of&amp;nbsp;an adapted version of a &lt;A href="https://commons.wikimedia.org/wiki/File:View_of_Chicago_from_Navy_Pier_-_panoramio.jpg" target="_self"&gt;Wikimedia Commons image attributed to Eduardo Manchon&lt;/A&gt;&amp;nbsp;and a tip from an &lt;A href="https://support.sas.com/resources/papers/proceedings11/277-2011.pdf" target="_self"&gt;old SGF Paper of Dan Heath's&lt;/A&gt;, here's a simpler&amp;nbsp;version of the code that generates a static B/W image of a&amp;nbsp;GTL vectorplot&amp;nbsp;fireworks show over the downtown Chicago skyline!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;CODE&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;* Chicago skyline with GTL vectorplot "fireworks";
 
data fireworks;                * Generate points for fireworks;
pi=constant('pi');
input r xo yo;                 * Read radius, x/y origin for fireworks;
firework+1;                    * Assign group ID for later vector plot;
do a=0 to 352.5 by 7.5;        * Line every 7.5 degrees;
  x=r*cos(a*pi/180)+xo;        * Calc x and y coordinates for fireworks;
  y=r*sin(a*pi/180)+yo;
  output;
end;
datalines;
.15 .13 .85
.23 .62 .775
.07 .95 .925
;
ods listing gpath='/folders/myfolders/fireworks';
ods graphics on / reset=index imagename='Chicago4thJuly' border=off
                  width=5in height=5in imagefmt=GIF;

data chicago;                  * Image of Chicago skyline;
retain function "Image" anchor "bottomleft" x1 0 y1 0 width 100 height 100
       widthunit 'percent' heightunit 'percent' imagescale  'fit'
       drawspace "layoutpercent" layer 'back' 
       id 'chicago' Image "/folders/myfolders/chicago.gif";

proc template;
define statgraph vectorplot;
begingraph / opaque=true border=false drawspace=layoutpercent backgroundcolor=black;
  layout overlayequated / equatetype=square border=false  
         WALLDISPLAY=NONE commonaxisopts=(viewmin=0 viewmax=1) 
         xaxisopts=(display=none) yaxisopts=(display=none);
    vectorplot y=y x=x xorigin=xo yorigin=yo / group=firework  
               arrowheads=false lineattrs=(pattern=solid color=white);
    annotate / id="chicago";           
  endlayout;
endgraph;
end;

proc sgrender data=fireworks template=vectorplot sganno=chicago;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;BACKGROUND IMAGE&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3896iC42B4698C7593609/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="chicago.gif" title="chicago.gif" /&gt;&lt;/STRONG&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;
&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, 02 Jul 2016 15:24:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/281844#M9988</guid>
      <dc:creator>tc</dc:creator>
      <dc:date>2016-07-02T15:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Take 2: Static B/W image of a GTL vectorplot "fireworks" over downtown Chicago skyline</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/281856#M9992</link>
      <description>&lt;P&gt;Having a 'blast' with your SAS graphic creativity Ted! Great work.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Jul 2016 20:08:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/281856#M9992</guid>
      <dc:creator>MichelleHomes</dc:creator>
      <dc:date>2016-07-02T20:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Fun With SAS ODS Graphics, July 4th Edition</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/570595#M18400</link>
      <description>&lt;P&gt;Thanks for sharing the fantastic animation.&amp;nbsp; I create the gif file by using your SAS code. But I don't know how to insert into Power Point slide to display. Could you enlighten me on it?&lt;/P&gt;&lt;P&gt;Thanks for your helps.&lt;/P&gt;&lt;P&gt;Ethan&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 15:19:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/570595#M18400</guid>
      <dc:creator>t75wez1</dc:creator>
      <dc:date>2019-07-02T15:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Take 2: Static B/W image of a GTL vectorplot "fireworks" over downtown Chicago skyline</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/570823#M18404</link>
      <description>&lt;P&gt;Oh well, someone had to cave in...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just crudely set the sky transparent, moved the fireworks to the upper half, and shifted the image to the foreground.&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="fourthofjuly.gif" style="width: 576px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30718iFE881091515530B9/image-size/large?v=v2&amp;amp;px=999" role="button" title="fourthofjuly.gif" alt="fourthofjuly.gif" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Now for the reflection on the water to be added ...&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;File with&amp;nbsp;transparent sky attached.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[Edit.&lt;/P&gt;
&lt;P&gt;PNG file not attached as it is rejected:&lt;/P&gt;
&lt;P&gt;The file does not have a valid extension for an attachment and has been removed. sas,txt,csv,zip,pdf,ics,sx,sxs,doc,docx,xls,xlsx,egp,sav,sas7bdat,ctm,ctk,rtf,py,spk are the valid extensions.&lt;/P&gt;
&lt;P&gt;I added it at the bottom but it seems to lose its transparency information.&lt;/P&gt;
&lt;P&gt;I used this website to add the transparency (color the sky red for example before uploading): &lt;A href="https://onlinepngtools.com/create-transparent-png" target="_blank"&gt;https://onlinepngtools.com/create-transparent-png&lt;/A&gt;&amp;nbsp; ]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Fun with GTL vectorplots, 4th of July animated GIF "fireworks";

data fireworks;                * Generate points for fireworks;
pi=constant('pi');
do firework=1 to 7;            * Seven fireworks "explosions";
  r=.2+ranuni(2)*.3;           * Random radius between .2 and .5;
  if firework=7 then r=.3;     * Big finish! (radius=.5);
  xo=r+ranuni(4)*(1-r*2);      * Random origin (x, y);
  yo=r+ranuni(6)*(1-r*2)/3+.4;
  do a=0 to 352.5 by 7.5;      * Line every 7.5 degrees;
    x=r*cos(a*pi/180)+xo;      * Calc x and y coordinates for fully-exploded fireworks;
    y=r*sin(a*pi/180)+yo;
    xi1=.01*cos(a*pi/180)+xo;  * Initial unexploded x, y points (r=.01, .02);
    yi1=.01*sin(a*pi/180)+yo;
    xi2=.02*cos(a*pi/180)+xo;
    yi2=.02*sin(a*pi/180)+yo;
    output;
  end;
end;

data empty;                    * Generate out-of-frame points to create "empty" frame;
x=-1; y=-1; xo=-1; yo=-1; r=1;
run;

ods _all_ close;               * Use generated points to produce animated GIF;
options papersize=('6 in', '6 in') printerpath=gif animation=start 
        nodate nonumber animduration=.1 animloop=YES NOANIMOVERLAY;
ods printer file="%sysfunc(pathname(WORK))\fourthofjuly.gif";
ods graphics / border=off width=6in height=6in imagefmt=GIF;

%macro fireworks;              * Vector plot (change pattern to "fade" fireworks;
%macro modtemplate(pattern=);
proc template;
define statgraph vectorplot;
begingraph ;*/ opaque=true border=false backgroundcolor=black;
  layout overlayequated / equatetype=square opaque=false border=false backgroundcolor=cx222222
         wallcolor=cx222222 WALLDISPLAY=(fill) commonaxisopts=(viewmin=0 viewmax=1) 
         xaxisopts=(display=none) yaxisopts=(display=none);
    vectorplot y=y x=x xorigin=xo yorigin=yo / 
               arrowheads=false lineattrs=(pattern=&amp;amp;pattern color=&amp;amp;linecolor thickness=1.6pt);
  annotate / id="chicago";  endlayout;
endgraph;
end;
run;
%mend;

%do f=1 %to 7;                  * Generate frames for animated GIF;
   data _null_;
   call symput("linecolor",scan("hotpink orange dodgerblue yellow lime white red", &amp;amp;f)); 
   run;
   %modtemplate(pattern=solid); * Initial unexploded frames (2 frames);
   proc sgrender data=fireworks(where=(firework=&amp;amp;f) drop=x y rename=(xi1=x yi1=y)) template=vectorplot sganno=chicago;;
   proc sgrender data=fireworks(where=(firework=&amp;amp;f) drop=x y rename=(xi2=x yi2=y)) template=vectorplot sganno=chicago;;
   %modtemplate(pattern=solid);
   %do i=1 %to 5;               * Fully exploded frames (5 frames);
     proc sgrender data=fireworks(where=(firework=&amp;amp;f)) template=vectorplot sganno=chicago; 
   %end;                        * Fading/empty frames (3 frames);
   %modtemplate(pattern=shortdashdot);
   proc sgrender data=fireworks(where=(firework=&amp;amp;f)) template=vectorplot sganno=chicago;
   %modtemplate(pattern=dot);
   proc sgrender data=fireworks(where=(firework=&amp;amp;f)) template=vectorplot sganno=chicago;
   proc sgrender data=empty template=vectorplot sganno=chicago;
%end;
run; 
%mend;

data chicago;                  * Image of Chicago skyline;
retain function "Image" anchor "bottomleft" x1 0 y1 0 width 100 height 100
       widthunit 'percent' heightunit 'percent' imagescale  'fit'
       drawspace "layoutpercent" layer 'fore' 
       id 'chicago' Image "%sysfunc(pathname(WORK))\ch.png";
run;

%fireworks;                     * Light 'em up!; 
options printerpath=gif animation=stop;
ods printer close;&lt;/CODE&gt;&lt;/PRE&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="ch.png" style="width: 505px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30719i3847E6E75F0FDEDC/image-size/large?v=v2&amp;amp;px=999" role="button" title="ch.png" alt="ch.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 05:37:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/570823#M18404</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-07-03T05:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: Fun With SAS ODS Graphics, July 4th Edition</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/570824#M18405</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt; But I don't know how to insert into Power Point slide to display.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Just insert as a normal image.&lt;/P&gt;
&lt;P&gt;see here:&amp;nbsp;&lt;A href="https://support.office.com/en-us/article/add-an-animated-gif-to-a-slide-3a04f755-25a9-42c4-8cc1-1da4148aef01" target="_blank"&gt;https://support.office.com/en-us/article/add-an-animated-gif-to-a-slide-3a04f755-25a9-42c4-8cc1-1da4148aef01&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The animation only shows in full screen mode.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 05:42:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/570824#M18405</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-07-03T05:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: Fun With SAS ODS Graphics, July 4th Edition</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/571122#M18409</link>
      <description>&lt;P&gt;With reflections!&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="j4.gif" style="width: 576px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30746iEA6FF18ED85C00EB/image-size/large?v=v2&amp;amp;px=999" role="button" title="j4.gif" alt="j4.gif" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Fun with GTL vectorplots, 4th of July animated GIF "fireworks";

data f;                * Generate points for fireworks;
pi=constant('pi');
do firework=1 to 7;            * Seven fireworks "explosions";
  r=.2+ranuni(2)*.3;           * Random radius between .2 and .5;
  if firework=7 then r=.5;     * Big finish! (radius=.5);
  xo=r+ranuni(4)*(1-r*2);      * Random origin (x, y);
  yo=r+ranuni(6)*(1-r*2)/3+.3;
  do a=0 to 352.5 by 7.5;      * Line every 7.5 degrees;
    x=r*cos(a*pi/180)+xo;      * Calc x and y coordinates for fully-exploded fireworks;
    y=r*sin(a*pi/180)+yo;
    xi1=.01*cos(a*pi/180)+xo;  * Initial unexploded x, y points (r=.01, .02);
    yi1=.01*sin(a*pi/180)+yo;
    xi2=.02*cos(a*pi/180)+xo;
    yi2=.02*sin(a*pi/180)+yo;

    *reflection;
    waterline=.4;
    h=yo-waterline;                                                  
    yyo=yo-h*2;  yy=y-h*2;
          
    *clip low Y;
    newy=max(y,waterline); 
    ratio=coalesce(divide(y-yo,newy-yo),1); x=xo+(x-xo)/ratio;  y=newy; 

    output;
  end;
end;

data empty;                    * Generate out-of-frame points to create "empty" frame;
  retain x y xo yo yy yyo -1 ;
run;

ods _all_ close;               * Use generated points to produce animated GIF;
options papersize=('6 in', '6 in') printerpath=gif animation=start 
        nodate nonumber animduration=.1 animloop=YES NOANIMOVERLAY;
ods printer file="%sysfunc(pathname(WORK))\j4.gif";
ods graphics / border=off width=6in height=6in imagefmt=GIF;

%macro fireworks;              * Vector plot (change pattern to "fade" fireworks;
%macro modtemplate(pattern=);
proc template;
define statgraph vectorplot;
begingraph ;
  layout overlayequated / equatetype=square walldisplay=(fill) wallcolor=cx222222 
          commonaxisopts=(viewmin=0 viewmax=1) xaxisopts=(display=none) yaxisopts=(display=none);
  vectorplot y=y x=x xorigin=xo yorigin=yo / 
             arrowheads=false lineattrs=(pattern=&amp;amp;pattern. color=&amp;amp;linecolor. thickness=1.6pt);
  annotate / id="chicago";  
  vectorplot y=yy x=x xorigin=xo yorigin=yyo / 
             arrowheads=false lineattrs=(pattern=&amp;amp;pattern. color=&amp;amp;linecolor2. thickness=1.6pt);
  endlayout;
endgraph;
end;
run;
%mend;

%do f=1 %to 7;                  * Generate frames for animated GIF;
   %let linecolor=%scan(hotpink orange dodgerblue yellow lime white red, &amp;amp;f); 
   %let linecolor2=%scan(verydarkpurple verydarkorange verydarkblue verydarkyellow verydarkgreen verydarkgrey verydarkred, &amp;amp;f); 
   %modtemplate(pattern=solid); * Initial unexploded frames (2 frames);
   proc sgrender data=f(where=(firework=&amp;amp;f.) drop=x y rename=(xi1=x yi1=y)) template=vectorplot sganno=chicago;
   proc sgrender data=f(where=(firework=&amp;amp;f.) drop=x y rename=(xi2=x yi2=y)) template=vectorplot sganno=chicago;
   %modtemplate(pattern=solid);
   %do i=1 %to 5;               * Fully exploded frames (5 frames);
     proc sgrender data=f(where=(firework=&amp;amp;f.)) template=vectorplot sganno=chicago; 
   %end;                        * Fading/empty frames (3 frames);
   %modtemplate(pattern=shortdashdot);
   proc sgrender data=f(where=(firework=&amp;amp;f.)) template=vectorplot sganno=chicago;
   %modtemplate(pattern=dot);
   proc sgrender data=f(where=(firework=&amp;amp;f.)) template=vectorplot sganno=chicago;
   proc sgrender data=empty template=vectorplot sganno=chicago;
%end;
run; 
%mend;

data chicago ;                  * Image of Chicago skyline;
  retain function "Image" anchor "bottomleft" x1 0 y1 0 width 100 height 100
         widthunit 'percent' heightunit 'percent' imagescale  'fit'
         drawspace "layoutpercent" layer 'fore' 
         id 'chicago' Image "%sysfunc(pathname(WORK))\ch2.png";
run;                

%fireworks;                     * Light 'em up!; 
options printerpath=gif animation=stop;
ods printer close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="the image with a transparent color" style="width: 505px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30747iFE8E12456E3D676C/image-size/large?v=v2&amp;amp;px=999" role="button" title="ch2.png" alt="the image with a transparent color" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;the image with a transparent color&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>Thu, 04 Jul 2019 03:37:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/571122#M18409</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-07-04T03:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: Fun With SAS ODS Graphics, July 4th Edition</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/616612#M19305</link>
      <description>&lt;P&gt;Thanks to the community and especially&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4628"&gt;@tc&lt;/a&gt;&amp;nbsp;for this -- we adapted the fireworks to &lt;A href="https://www.instagram.com/p/B7JIvmCAoy4/" target="_self"&gt;celebrate the 10,000 followers on the&amp;nbsp;&lt;STRONG&gt;sassoftware&lt;/STRONG&gt; Instagram handle&lt;/A&gt;.&amp;nbsp; Props!&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 21:27:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-July-4th-Edition/m-p/616612#M19305</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2020-01-10T21:27:08Z</dc:date>
    </item>
  </channel>
</rss>

