It appears the attributions map only applies to the GROUP option and not the other GROUPxC options. Is there a way to specify colors used for each potential legend item? Note, I need the legend to include all protection status options, even if some are not present.
data attrmap;
infile datalines dlm="," dsd;
length markersymbol $15.
value $30.
fillcolor linecolor markercolor $10.;
input id $ value $ fillcolor $ linecolor $ markercolor $ markersymbol $ linepattern;
datalines;
prtct, Protected Following CHMI 1, #f06800, #f06800, #f06800, CircleFilled, 1
prtct, Unprotected Following CHMI 1, #ffa866, #ffa866, #ffa866, CircleFilled, 1
prtct, Unprotected Following CHMI 2, VPAP, VPAP, VPAP, CircleFilled, 1
prtct, Protected Following CHMI 2, VIP, VIP, VIP, CircleFilled, 1
prtct, Not Challenged, grey, grey, grey, X, 1
;
run;
ods graphics on / reset= index border= no width= 10in height= 6in attrpriority= none;
proc sgpanel data= rpt dattrmap= attrmap noautolegend;
panelby armn / novarname onepanel columns= 1 headerattrs= (family="times new roman" size=9pt) sort= data;
series x= plvisdy y= aval / group= patid grouplc= pstat grouplp= pstat groupmc= pstat groupms= pstat attrid= prtct name= "status" markers nomissinggroup;
colaxis label= "Study Day Relative to First Vaccination" labelattrs= (family="times new roman" size=10pt)
valueattrs= (family="times new roman" size=9pt) values= (1 29 57 71 85 120 141 176 323 379 558) offsetmin= 0.02;
rowaxis label= "Background-Adjusted Percentage" labelattrs= (family="times new roman" size=10pt)
valueattrs= (family="times new roman" size=9pt) /*max= 100 min= 0*/;
refline ref1 / axis= x lineattrs= (pattern=4);
refline ref2 / axis= x;
keylegend "status" / title= "Protection Status" titleattrs= (family="times new roman" size= 9pt)
valueattrs= (family= "times new roman" size= 9pt) position= bottom noborder type= markercolor across= 2;
format armn ARMN.;
run;
The DATTRMAP data set variable SHOW controls the behavior of appearance in the legend. If you use a variable
with the value of "DATA" then only the groups that have values appear in the legend, this is the default. The value of "ATTRMAP" for show will display all of the group values whether there are any in the data or not.
I not infrequently create two versions of an ID, with the Data and the other with ATTRMAP.
The documentation is pretty clear:
GROUPLC=variable
specifies a variable that determines the line colors for a grouped plot independently of the GROUP= variable.
"independently of the Group" means overrides/replaces any Group characteristic.
You aren't very clear about what you may want to do but there are the options like LCATTRID LPATTRID MCATTRID (and others) to modify behavior of the GROUPLC GROUPLP GROUPMC variables (and others)
The DATTRMAP data set variable SHOW controls the behavior of appearance in the legend. If you use a variable
with the value of "DATA" then only the groups that have values appear in the legend, this is the default. The value of "ATTRMAP" for show will display all of the group values whether there are any in the data or not.
I not infrequently create two versions of an ID, with the Data and the other with ATTRMAP.
The documentation is pretty clear:
GROUPLC=variable
specifies a variable that determines the line colors for a grouped plot independently of the GROUP= variable.
"independently of the Group" means overrides/replaces any Group characteristic.
You aren't very clear about what you may want to do but there are the options like LCATTRID LPATTRID MCATTRID (and others) to modify behavior of the GROUPLC GROUPLP GROUPMC variables (and others)
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.