Hi @ballardw
I have been struggling to express what I want.
So ignore the Subject of the thread (in fact, I will rename it to be less confusing).
Also, thanks for spotting the CXRRGGBB mistake, that was, of course, a column header that got copied in. The first row, of course, should be CX000000.
So let me try to state the problem all over again.
I have multiple plots for which I want to use an attribute map, this one is an example:
DATA ORs;
INPUT YLabel $ Level E L U IndentWt GrpText GrpLine Ref _N;
DATALINES;
Death 1 . . . 0 0 0 1 1
Intervention 2 0.55913 0.47636 0.6563 1 1 1 . 2
Days 2 2.80867 2.56724 3.0728 1 2 2 . 3
Sex 2 0.76004 0.64817 0.8912 1 3 3 . 4
Age 2 6.26008 3.89077 10.0722 1 4 4 . 5
Ward 2 1.67351 1.33596 2.0963 1 5 5 . 6
ED 2 4.11632 3.2314 5.2436 1 6 6 . 7
Lactate 1 . . . 0 0 0 8 8
Intervention 2 0.87583 0.70427 1.0892 1 1 1 . 9
Days 2 3.31815 2.99353 3.678 1 2 2 . 10
Sex 2 0.41019 0.33098 0.5084 1 3 3 . 11
Age 2 0.66652 0.51794 0.8577 1 4 4 . 12
Ward 2 0.44343 0.35548 0.5532 1 5 5 . 13
ED 2 1.23311 0.98223 1.5481 1 6 6 . 14
BP 1 . . . 0 0 0 15 15
Intervention 2 0.69487 0.62944 0.7671 1 1 1 . 16
Days 2 2.49906 2.37615 2.6283 1 2 2 . 17
Sex 2 0.7858 0.71351 0.8654 1 3 3 . 18
Age 2 1.14297 1.00717 1.2971 1 4 4 . 19
Ward 2 0.59325 0.53268 0.6607 1 5 5 . 20
ED 2 1.2314 1.10566 1.3714 1 6 6 . 21
eGFR 1 . . . 0 0 0 22 22
Intervention 2 0.82326 0.76245 0.8889 1 1 1 . 23
Days 2 3.0386 2.91297 3.1697 1 2 2 . 24
Sex 2 0.98662 0.91651 1.0621 1 3 3 . 25
Age 2 4.25326 3.68021 4.9155 1 4 4 . 26
Ward 2 0.80556 0.73838 0.8789 1 5 5 . 27
ED 2 2.3231 2.13229 2.531 1 6 6 . 28
;
RUN;
PROC SGPLOT
NOAUTOLEGEND
NOBORDER
NOCYCLEATTRS
NOWALL
DATTRMAP=_AttrMap
DATA=ORs;
/* It works to use GB hex values in STYLEATTRS */
/* STYLEATTRS DATACONTRASTCOLORS=(CXF78874 CXDE90BD CX7CAFD7 CX3FBDA5 CX92B85B CXE39F4F) DATALINEPATTERNS=(1);*/
XAXIS DISPLAY=(NOLABEL)
LABELATTRS=(SIZE=8)
VALUES=(0.25 0.5 1 to 12 by 1)
VALUEATTRS=(SIZE=6)
TYPE=Log;
YAXIS REVERSE
TYPE=DISCRETE
DISPLAY=NONE
OFFSETMIN=0.01;
YAXISTABLE YLabel
/LOCATION=INSIDE
POSITION=LEFT
TEXTGROUP=GrpText
TEXTGROUPID=text
NOLABEL
INDENTWEIGHT=IndentWt
SEPARATOR;
REFLINE 1 /AXIS=X LINEATTRS=(COLOR=BLACK);
REFLINE Ref /AXIS=Y LINEATTRS=(COLOR=LIGHTBLUE) TRANSPARENCY=0.8 DISCRETETHICKNESS=0.8;
SCATTER Y=_N
X=E
/MARKERATTRS=(SIZE=6 SYMBOL=SQUARE)
ATTRID=line
GROUP=GrpLine;
HIGHLOW Y=_N
LOW=L
HIGH=U
/ATTRID=line
GROUP=GrpLine;
TITLE;
RUN;
If I define the colours using the STYLEATTRS statement (commented out above), then it works, but this defeats the purpose of using an attribute map to simplify the creation of numerous charts using a consistent colour scheme.
If I create an attribute map using CNS colour names, the SGPLOT statement works:
DATA _AttrMap;
INPUT ID $ Value TextColor $ TextSize TextWeight $ TextStyle $ linecolor $ fillcolor $ linepattern;
DATALINES;
text 0 black 7 bold normal . . 1
text 1 red 7 normal italic . . 1
text 2 pink 7 normal italic . . 1
text 3 purple 7 normal italic . . 1
text 4 yellow 7 normal italic . . 1
text 5 blue 7 normal italic . . 1
text 6 green 7 normal italic . . 1
line 0 black . . . black black 1
line 1 red . . . red red 1
line 2 pink . . . pink pink 1
line 3 purple . . . purple purple 1
line 4 yellow . . . yellow yellow 1
line 5 blue . . . blue blue 1
line 6 green . . . green green 1
;
RUN;
However, if I recreate the attribute map using RGB colours (this time using arbitrary colour codes from the list created by @Ksharp , just to ensure that I have only valid codes):
DATA _AttrMap;
INPUT ID $ Value TextColor $ TextSize TextWeight $ TextStyle $ linecolor $ fillcolor $ linestyle;
DATALINES;
text 0 CX000000 7 bold normal . . 1
text 1 CX0000FF 7 normal italic . . 1
text 2 CXD2691E 7 normal italic . . 1
text 3 CX7FFF00 7 normal italic . . 1
text 4 CX5F9EA0 7 normal italic . . 1
text 5 CXDC143C 7 normal italic . . 1
text 6 CX00FFFF 7 normal italic . . 1
line 0 CX000000 . . . CX000000 CX000000 1
line 1 CX0000FF . . . CX0000FF CX0000FF 1
line 2 CXD2691E . . . CXD2691E CXD2691E 1
line 3 CX7FFF00 . . . CX7FFF00 CX7FFF00 1
line 4 CX5F9EA0 . . . CX5F9EA0 CX5F9EA0 1
line 5 CXDC143C . . . CXDC143C CXDC143C 1
line 6 CX00FFFF . . . CX00FFFF CX00FFFF 1
;
RUN;
Then the full log is just a repetition of what I copied in the original post, but to satisfy everyone's curiosity:
ERROR 22-322: Syntax error, expecting one of the following: ;, (, FILLATTRS, LINEATTRS,
MARKERATTRS, TEXTATTRS.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: ;, (, FILLATTRS, LINEATTRS,
MARKERATTRS, TEXTATTRS.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: ;, (, FILLATTRS, LINEATTRS,
MARKERATTRS, TEXTATTRS.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: ;, (, FILLATTRS, LINEATTRS,
MARKERATTRS, TEXTATTRS.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: ;, (, FILLATTRS, LINEATTRS,
MARKERATTRS, TEXTATTRS.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: ;, (, FILLATTRS, LINEATTRS,
MARKERATTRS, TEXTATTRS.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: ;, (, FILLATTRS, LINEATTRS,
MARKERATTRS, TEXTATTRS.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: ;, (, FILLATTRS, LINEATTRS,
MARKERATTRS, TEXTATTRS.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: ;, (, FILLATTRS, LINEATTRS,
MARKERATTRS, TEXTATTRS.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: ;, (, FILLATTRS, LINEATTRS,
MARKERATTRS, TEXTATTRS.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: ;, (, FILLATTRS, LINEATTRS,
MARKERATTRS, TEXTATTRS.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: ;, (, FILLATTRS, LINEATTRS,
MARKERATTRS, TEXTATTRS.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: ;, (, FILLATTRS, LINEATTRS,
MARKERATTRS, TEXTATTRS.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: ;, (, FILLATTRS, LINEATTRS,
MARKERATTRS, TEXTATTRS.
ERROR 200-322: The symbol is not recognized and will be ignored.
WARNING: Object will not be saved.
NOTE: PROCEDURE SGPLOT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 14 observations read from the data set WORK._ATTRMAP.
@ballardw I find it interesting that your example works, but the plot is slightly different, it uses textcolor, whereas I am using textcolor. linecolor and fillcolor.
Why does my example attribute map work when those three are defined with CNS names, but not with RGB codes?
... View more