Hello, I am trying to use GTL to make a template for a series of pie charts (I know, I know) that are needed for my org. I am trying to use the DISCRETEATTRMAP statement to ensure that certain levels retain the same colors in the pie chart. (People will be viewing lots of these, so I need consistency across charts). The variables in my data set are numeric, and I am using a format to bin them into categories. The desired output is a pie chart with wedges, but this code is making concentric circles and is not applying the colors. I have read the documentation that I can find but am still stumped about where I'm going wrong. If I remove the GROUP statement, I get a pie chart with wedges, but not with the correct colors. Any tips would be appreciated! data test;
input x @@;
datalines;
1 2 2 3 3 3 4 4 4 4 6 6 6 6 6 6 6 7 7 7 5 5 4 4 3 3
;
run;
** Load the binning format ;
proc format;
value bin
1 = 'Never'
2 = 'Once or Twice'
3 - 7 = 'Multiple Times'
;
proc template;
define statgraph pie2;
begingraph;
entrytitle "Overall";
discreteattrmap name='colors' /ignorecase=true; ** This is where things are going wrong. ;
value 'Never' / fillattrs= (color=green) ;
value 'Once or Twice' / fillattrs= (color=yellow) ;
value 'Multiple Times'/ fillattrs= (color=red);
enddiscreteattrmap ;
discreteattrvar attrvar=classfill var=x attrmap='colors';
layout region;
piechart category = x /
stat = pct
datalabellocation = inside
categorydirection = clockwise
start = 180
name = 'pie'
group = classfill;
discretelegend 'pie'
;
endlayout;
endgraph;
end;
run;
proc sgrender data = test
template = pie2;
format x bin.;
run;
... View more