Published on :
Macro CREATION_INTERNE

Defining Graphic Parameters for GIF Output

This code is also available in: Deutsch Español Français
This macro named 'gif' allows defining output parameters for creating graphics in GIF format. It configures the output file name, the device driver, and the image dimensions (horizontal and vertical). The macro uses another macro (%sasgfile) to determine the base file name. Parameters can be passed directly, or read from global macro variables or system environment variables.
Data Analysis

Type : CREATION_INTERNE


The macro does not process any input data. Its role is to configure the graphic environment for file generation, not to manipulate data tables.

1 Code Block
Macro
Explanation :
This block defines the '%gif' macro. It starts by determining the output file name via the call to the '%sasgfile' macro. Then, it resolves the graphic driver to use ('device'), prioritizing the macro parameter, then a global macro variable 'DRIVER', then a system environment variable 'DRIVER', and finally the default value 'gif'. It defines a fileref 'gsasfile' for the output path. Finally, it applies the configurations using the GOPTIONS statement, specifying the driver, access path, replacement mode, and image dimensions.
Copied!
1%macro gif(
2 fn,
3 device=,
4 hsize=,
5 vsize=
6 );
7 
8 %*-- Get the basename of the graphic file(s);
9 %sasgfile(gif,&fn);
10 
11 %IF %LENGTH(&device) %THEN %DO;
12 %let dev=&device;
13 %END;
14 %ELSE %DO;
15 %IF not %defined(DRIVER) %THEN
16 %let driver =%SYSGET(DRIVER);
17 %IF &driver=%str() %THEN %let driver = gif;
18 %let dev=&driver;
19 %END;
20
21 %let devtyp = GIF;
22 %let fig=1;
23 %IF %defined(gsasdir)=0 %THEN %let gsasdir=;
24 %put GIF: gsasfile is: "&gsasdir.&gsasfile" (&dev driver);
25 filename gsasfile "&gsasdir.&gsasfile";
26 
27 goptions device=&dev gaccess=gsasfile
28/* hpos=80 vpos=75 match pscolor device */
29 gsflen=80 gsfmode=replace;
30 goptions vsize=&vsize hsize=&hsize;
31%mend gif;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Author: Michael Friendly <friendly @yorku.ca>