Hi all, I need to assign colors to the group/class in a series plot and an axis table, and a superscript is needed for one of class values. Please see the inserted SAS code. 1. I defined a format sup_eth to change "Other1" to "Other" with a superscript 1. 2. The format sup_eth is assigned to a variable "group" in the data UGRD_Div1. 3. UGRD_Div1 is sorted. 4. I defined a template for following SGRender. The template contains two plots, a series plot and an axis table. I use a statement discreteattrvar to identify which part of attribute map to use (attrmap="Eth") on which variable (var=group). 5. A SGRender to output the graph. The variable group in the data UGRD_Div1 has five values, which are Hispanic, Black/African American, Asian, Two or more races and Other1. The colors in the first four values are fine, but the color for Other1 is not the color I want to assign, and the color is actually the ContrastColor for GraphData5 (the default color for the fifth line of a ODS graph in style HtmlBlue). The color for Other1 is correctly assigned, if I take off the format step. So my conclusion is the format procedure conflicts with the attribute map. My question is how to assign colors and format at the same time in an ODS graph. My specific program is assign a color to a value of a group variable and one value of the variable needs a superscript 1. Thanks for your time to help me in advance! Chuan proc format;
value $sup_eth
'Other1' = "Other(*ESC*){unicode '00b9'x}";
run;
Data UGRD_Div1;
set UGRD_Eth;
Pct = round (Pct_row,0.1)/100;
Label_descr = strip(round(Pct_row,0.1))||'% ('||strip(Count)||')';
format Pct percentn7.1;
format group $sup_eth.;
run;
Proc sort data=UGRD_Div1;
by year descending Pct_row ;
run;
Proc template;
define statgraph UGRD_DIV1;
begingraph /designwidth=600px designheight=540px ;
entrytitle 'Percent of Total Undergraduate Enrollment';
discreteattrvar attrvar=group var=group attrmap="Eth";
layout lattice/rows=2 rowgutter=0 rowweights=(0.65 0.35);
layout overlay/xaxisopts=(display=(tickvalues) )
yaxisopts=(griddisplay=on label='Percent Total Enrollment' /*labelposition=top*/ labelattrs=(weight=bold)) ;
seriesplot x=year y=Pct /group=group markerattrs=(symbol=circlefilled size=6pt) lineattrs=(thickness=3 ) display=all ;
endlayout;
layout overlay /xaxisopts=(type=discrete display=none) border=false ;
axistable x=year value=Label_descr/class=group colorgroup=group display=(label) ValueATTRS=(color= black) labelattrs=(weight=bold) ;
endlayout;
endlayout;
entryfootnote halign=left {sup "1"}" Other includes Alaska Native or American Indian, Native Hawaiian or Other Pacific Islander."/TEXTATTRS=(size=7pt) ;
endgraph;
end;
run;
ods rtf file='I:\UGRD_04052018_test.rtf' style=HTMLBLUE ;
proc sgrender data=UGRD_DIV1 template=UGRD_DIV1 DATTRMAP=ATTRMAP;
run;
ods rtf close;
... View more