BookmarkSubscribeRSS Feed
u62411551
Calcite | Level 5

I have the PNGs and the Code to Animate.  See below: I need the correct path to output the animated GIF file.

data my_anno1x;
  length function $8 imgpath $100;
  xsys='3'; ysys='3'; when='a';
  x=0; y=0; function='move'; output;
  x=100; y=100; function='image'; style='fit';
  imgpath="/home/u62411551/A1.png"; output;
run;
data my_anno2x;
  length function $8 imgpath $100;
  xsys='3'; ysys='3'; when='a';
  x=0; y=0; function='move'; output;
  x=100; y=100; function='image'; style='fit';
  imgpath="/home/u62411551/A2.png"; output;  
run;
data my_anno3x;
  length function $8 imgpath $100;
  xsys='3'; ysys='3'; when='a';
  x=0; y=0; function='move'; output;
  x=100; y=100; function='image'; style='fit';
  imgpath="/home/u62411551/A3.png"; output;
run;
data my_anno4x;
  length function $8 imgpath $100;
  xsys='3'; ysys='3'; when='a';
  x=0; y=0; function='move'; output;
  x=100; y=100; function='image'; style='fit';
  imgpath="/home/u62411551/A4.png"; output;  
run;
data my_anno5x;
  length function $8 imgpath $100;
  xsys='3'; ysys='3'; when='a';
  x=0; y=0; function='move'; output;
  x=100; y=100; function='image'; style='fit';
  imgpath="/home/u62411551/A5.png"; output;
run;
/* Set up the appropriate GOPTIONS */
goptions reset=all device=gif;
goptions xpixels=2000 ypixels=2000;  
goptions cback=white gunit=pct;
goptions noborder;
/* Set the options for GIF animation */
options nodate nonumber; /* papersize=("7in" "5in"); */  
options /* dev=sasprtc printerpath=gif */ animduration=.3 animloop=/*0*/ /*1*/ 0
       animoverlay=no animate=start center;
run;
/* output to disk. */
ods _all_ close;
ods html gpath='\home\u12345678\' (url=none)  
          file='\home\u12345678\'
         style=htmlblue;
/* Use multiple PROC GSLIDE steps to read the PNG graphs */
/* on disk into SAS                                      */
goptions gsfmode=replace;     /* For the first graph, gsfmode=replace */
proc gslide anno=my_anno1x des=''; run; quit;
goptions gsfmode=append;     /* For the rest of the images */
proc gslide anno=my_anno2x des=''; run; quit;
proc gslide anno=my_anno3x des=''; run; quit;
proc gslide anno=my_anno4x des=''; run; quit;
proc gslide anno=my_anno5x des=''; run; quit;
ods html close;
ods listing;
 
 
1 REPLY 1
ChrisHemedinger
Community Manager

There are several ways to generated animated GIF output with SAS, and most modern approaches would use SGPlot for this. However, given that you already have the "frames" as PNG files, I think you can accomplish it by specifying the GSFNAME option and simplify your ODS wrapper. In this example, the output would be in your home directory as output.gif.

 

BTW, use forward slashes (not backslash) in file paths in this environment. Forward slash almost always does the job in Windows or Unix SAS sessions, but backslash is good only on Windows.

 

filename gifout "&userdir/output.gif";
ods listing;
/* Use multiple PROC GSLIDE steps to read the PNG graphs */
/* on disk into SAS                                      */
goptions gsfname=gifout gsfmode=replace;     /* For the first graph, gsfmode=replace */
proc gslide anno=my_anno1x des=''; run; quit; 
goptions gsfname=gifout gsfmode=append;     /* For the rest of the images */
proc gslide anno=my_anno2x des=''; run; quit; 
proc gslide anno=my_anno3x des=''; run; quit; 
proc gslide anno=my_anno4x des=''; run; quit; 
proc gslide anno=my_anno5x des=''; run; quit; 
ods listing close;

 

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 657 views
  • 0 likes
  • 2 in conversation