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;

 

SAS Innovate 2025: Call for Content! Submit your proposals before Sept 16. Accepted presenters get amazing perks to attend the conference!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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