Published on :
Macro CREATION_INTERNE

FORMCHAR Macro for Formatting Character Management

This code is also available in: Deutsch Español Français
This macro, FORMCHAR, is designed to dynamically adjust the global FORMCHAR system option. This option is crucial for defining the characters used for rendering borders and frames in ODS output, particularly with procedures like PROC TABULATE. The macro includes compatibility checks to ensure it is executed under Windows and with a SAS© version equal to or greater than 6.11. The user can specify 'LINEDRAW' (or 'LINE', 'DRAW') to use line drawing characters or 'STANDARD' (or 'STD', 'ASCII') for classic ASCII characters. If an invalid argument is provided or if system conditions are not met, error messages are displayed in the SAS© log. Line drawing characters are defined via a hexadecimal string to ensure specific compatibility with the SAS© Monospace font.
Data Analysis

Type : CREATION_INTERNE


The macro does not directly process external data or SASHELP data. It operates on system options and uses automatic macro variables (`&sysscp`, `&sysver`) for its internal logic. The values applied to the FORMCHAR option are constants defined within the macro.

1 Code Block
MACRO
Explanation :
This block defines the FORMCHAR macro. It starts with conditional checks to ensure the code is executed under Windows (`%if &sysscp ^= WIN`) and with a compatible SAS version (6.11 or higher, `%if &sysver < 6.11`). If these conditions are not met, error messages are displayed. Then, the `chartype` parameter is converted to uppercase (`%upcase`). Conditional `%if/%else %if` statements are used to determine the value to assign to the `FORMCHAR` system option. If `chartype` matches 'STANDARD' (or 'STD', 'ASCII'), ASCII characters are used. If `chartype` matches 'LINEDRAW' (or 'LINE', 'DRAW'), a specific hexadecimal string is assigned. Any other argument results in an error message.
Copied!
1/* Select either "standard" or "linedraw" characters for FORMCHAR */
2%macro formchar ( chartype /* STANDARD or LINEDRAW */
3 ) ;
4 /* ------------------------------------------------------------
5 MODULE: FORMCHAR
6 
7 PURPOSE: Resets the value of the FORMCHAR system option
8 to use either "linedraw" characters from the SAS
9 Monospace font or "standard" characters (+- etc.)
10 for box characters in TABULATE and other PROCs.
11 Generates an OPTIONS statement and may be used
12 wherever that is accepted.
13 
14 CLASS: General SAS statement.
15 
16 USAGE: %FORMCHAR(LINEDRAW)
17 
18 PARAMETERS: R chartype Must be either
19 LINEDRAW, LINE, DRAW or
20 STANDARD, STD, ASCII
21 
22 SIDE EFFECTS: None.
23 SYSTEMS: Windows, 6.11 and higher.
24 HISTORY: 25feb96 MDR
25 DOCUMENT: Here.
26 SUPPORT: Mike Rhoads <rhoadsm1 @westat.com>
27 ------------------------------------------------------------
28 */
29 
30 %IF &sysscp ^= WIN %THEN
31 %put ERROR: The FORMCHAR macro is only available under Windows.;
32 %ELSE %IF &sysver < 6.11 %THEN
33 %put ERROR: The FORMCHAR macro is not available for versions prior to 6.11.;
34 %ELSE %DO;
35 %let chartype = %upcase(&chartype);
36 %IF %index(STD STANDARD ASCII,&chartype)>0 %THEN %DO;
37 OPTIONS FORMCHAR = '|----|+|---+=|-/\<>*';
38 %END;
39 %ELSE %IF %index(LINEDRAW,&chartype)>0 %THEN %DO;
40 OPTIONS FORMCHAR = '82838485868788898A8B8C2B3D7C2D2F5C3C3E2A'X;
41 %END;
42 %ELSE
43 %put ERROR: Argument to FORMCHAR must be LINEDRAW or STANDARD.;
44 %END;
45 
46%mend FORMCHAR ;
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 : Creator: MDR, February 25, 1996. Support: Mike Rhoads <rhoadsm1 @westat.com>