Search code examples
sassgplot

How do I change colours of different bars in SAS?


proc sgplot data=WORK.CUSTOMERDATA;
    title height=14pt "Bar Chart of Gender";
    vbar Gender / fillattrs= (color=CX024ae6) datalabel;
    
    yaxis grid;
run;

ods graphics / reset;
title;

Bar Chart of Graduated

how do I change the colour of individual bars ? I have tried fill= and styleattrs datacolors= but it doesn't seem to work..


Solution

  • Should you wish to have one color for the graduated and another for the ones that did not, the following should provide the desired output

    proc sgplot data=customerdata;
    title height=14pt "Bar Chart of Graduated";
    styleattrs datacolors=(blue red) ;
    vbar Graduated / group=Graduated filltype=solid datalabel;
    yaxis grid;
    run;
    

    enter image description here