Published on :
Graphic CREATION_INTERNE

Generating Graphic Symbol Definitions

This code is also available in: Deutsch Español Français
The script uses a Data Step to read a list of marker styles (shape, font, color) via datalines ('cards'). It uses `CALL SYMPUT` to create a series of global macro variables containing `symbolN value=...` statements. A `%symbols` macro is then defined to execute these symbol definitions in a loop, allowing the appropriate style to be applied based on the number of groups to visualize.
Data Analysis

Type : CREATION_INTERNE


Symbol definitions (shapes and colors) are hardcoded in the script via the CARDS statement.

1 Code Block
DATA STEP
Explanation :
Reads symbol properties, constructs the corresponding SAS/GRAPH command string, and stores it in a macro variable.
Copied!
1DATA _null_;
2 INFILE CARDS eof=END;
3 LENGTH sym $200;
4 INPUT value $char8. +1 font $char8. +1 color $char8.;
5 x=_n_;
6 y=_n_;
7 z=_n_;
8 OUTPUT;
9 x+1;
10 OUTPUT;
11 
12 IF value='"' then value="'"||'"'||"'";
13 
14 sym="symbol"||trim(left(put(_n_,2.)))||" value="||value;
15 IF font ^= "" THEN sym=trim(sym)||' font='||font;
16 IF color^= "" THEN sym=trim(sym)||' color='||color;
17 ELSE sym=trim(sym)||' color=black';
18 
19 call symput ('symbol'||left(put(_n_,2.)), trim(sym));
20 return;
21 
22END:
23 call symput ('Nsymbol', left(put(_n_-1,8.)));
24 delete;
25 
26 CARDS;
27dot black filled-circle
28U marker blue filled-square
29/* ... suite des données ... */
30 ;
31RUN;
2 Code Block
MACRO
Explanation :
Defines the macro that applies the previously generated symbol definitions.
Copied!
1%macro symbols (groups);
2 %IF (&groups > &Nsymbol) %THEN %let groups=&Nsymbol;
3 goptions reset=symbol;
4 %DO i=1 %to &groups;
5 &&symbol&i;
6 %END;
7%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 : Richard A. DeVenezia, 93/06/30