BookmarkSubscribeRSS Feed
Anita_n
Pyrite | Level 9

Dear all, 

I used sgplot to plot a graph including an xaxistable. The group colors are defined in an attrmap. I want the color of the curves to be the same as groups definde in the xaxistable. How can I do this?

 

I used attrid=var1, colorgroup=var1 but am not getting it working 

on the step statement I used group=var1 attrid=var1 but on the xaxistable this isn't working

5 REPLIES 5
ballardw
Super User

Code

Contents of the Dattrmap data set

Data to test the code.

Any custom format definitions used with the plot variables.

 

If you don't define the Dattrmap with enough options there isn't anything for Axistable to use.

Your code so we know what options you are using.

Data and formats because we need to see the formatted values of your variables to see if your Dattrmap is correct for the code used.

Anita_n
Pyrite | Level 9
ods graphics / reset= all ;
proc sgplot data=PlotData2 dattrmap=myattrmap noborder;

styleattrs axisextent=data;
dropline x=dropx y=dropy / dropto=y;
refline 0 / axis=x;

step x=time y=survival / group=stratum  attrid=stratum lineattrs=(pattern=solid) name='s';
scatter x=time y=censored / markerattrs=(symbol=plus) name='c';
scatter x=time y=censored / markerattrs=(symbol=plus) GROUP=stratum;

xaxistable atrisk / x=tatrisk location=outside class=stratum colorgroup=stratum  attrid=stratum
              valueattrs=(size=7 weight=bold) labelattrs=(size=8) nomissingclass;

yaxis display=(noline noticks);
xaxis label="Time in days";

keylegend 'c' / location=inside position=topright;
keylegend 's' / linelength=20;
run;

Here is the code and data

ballardw
Super User

Your dattrmap data set has nothing related to TEXTCOLOR. You only  set colors for Fillcolor and Linecolor. So markers and text do not have any color values to use.

 

Search the Online help for "Reserved Discrete Attribute Map Variables" to find all of the variables possible that can go into the attribute map set.

Anita_n
Pyrite | Level 9

I got it working for the at risk values (after adding textcolor to the attrmap) but the group names of the atrisk values changed complete to black (I mean here treatment A, B, C, D, E)

I searched but did not find any attribute variable that defines that

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 5 replies
  • 1087 views
  • 1 like
  • 3 in conversation