BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
mariko5797
Pyrite | Level 9

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;
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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)

 

 

View solution in original post

2 REPLIES 2
ballardw
Super User

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)

 

 

mariko5797
Pyrite | Level 9
I needed the lines and points to be displayed for each subject (GROUP= patid), but the colors and patterns to be based on protection status (GROUPxC= pstat). Adding the LCATTRID, etc. seemed to do the trick. Thank you!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 457 views
  • 0 likes
  • 2 in conversation