Published on :
Graphic Utility CREATION_INTERNE

Setting Graphic Parameters for PDF Output

This code is also available in: Deutsch Español Français
This macro configures SAS©/GRAPH graphic options to generate files in PDF format. It accepts the output file name (`fn`), as well as the horizontal (`hsize`) and vertical (`vsize`) image sizes as parameters. The macro handles SAS© version detection (`&sysver`) to dynamically adjust `gprolog` and `gaccess` parameters, thus ensuring cross-version compatibility. The output file name and directory are constructed using the global variables `gsasfile` and `gsasdir`, allowing for customization of the save path. Graphic options (`goptions`) are then applied to define the output device, access and write modes, as well as text style and output dimensions.
Data Analysis

Type : CREATION_INTERNE


This script is a configuration macro and does not directly process input data for analysis. It manipulates macro parameters and system options to prepare the environment for generating graphic outputs in PDF format. Output file names are dynamically constructed from parameters provided to the macro or from environment variables.

1 Code Block
MACRO %PDF
Explanation :
This code block defines the `%PDF` macro. It first declares global macro variables (`gsasfile`, `gsasdir`, `devtyp`) used for managing output files. Inside the macro, the graphic device type is set to 'PDF'. The macro uses the external macro `%sasgfile` to construct the base name of the graphic file. A full path is then assigned to the `gsasfile` fileref. Conditional logic based on the SAS system version (`&sysver`) adjusts the `gprolog` and `gaccess` parameters to ensure compatibility. Finally, several `goptions` statements are used to configure the graphic device, output dimensions, text font, file writing mode, and other attributes of the PDF output.
Copied!
1 %global gsasfile gsasdir devtyp;
2 
3%macro pdf(
4 fn,
5 hsize=6in,
6 vsize=6in
7 );
8 
9 %let devtyp=PDF;
10 %let dev=pdf;
11 %local gprolog gaccess;
12 
13 %*-- Get the basename of the graphic file(s);
14 %sasgfile(pdf,&fn);
15 
16 %put PDF: gsasfile is: "&gsasdir.&gsasfile";
17 filename gsasfile "&gsasdir.&gsasfile";
18 
19 %IF &sysver < 6.08 %THEN %DO;
20 %let gprolog='2521'x;
21 %let gaccess=sasgaedt;
22 %END;
23 %ELSE %DO;
24 %let gprolog=;
25 %let gaccess=gsasfile;
26 %END;
27 
28goptions device=&dev gaccess=&gaccess gsfname=gsasfile gsflen=80
29 hpos=70 vpos=65 /* match pscolor device */
30 gsfmode=append gprolog=&gprolog;
31goptions lfactor=3;
32goptions ftext='helvetica';
33goptions hsize=&hsize vsize=&vsize;
34%mend;
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> Created: 5 Dec 1996 14:30:47 Revised: 5 Jan 1997 10:46:34 Version: 1.1