When I set up my bar chart, it renders as expected but I get no color differences by group. I tries using ATTRID with no success. In addition I need to place the data labels in the middle of the bars not the top or the bottom which appear to be the only standard options available.I also tried the style attribute datacontrastcolors also with no success.
data attrmap;
length value FillColor LineColor $8;
Id='A'; Value="XX N"; FillColor='Red'; LineColor='Black'; output;
Id='A'; Value="XX C"; FillColor='Yellow'; LineColor='Black'; output;
Id='A'; Value="XX R"; FillColor='Green'; LineColor='Black'; output;
Id='A'; Value="XX M"; FillColor='Blue'; LineColor='Black'; output;
Id='A'; Value="XX K"; FillColor='Orange'; LineColor='Black'; output;
run;
proc sgplot data = geography dattrmap=attrmap;
where index(put(businessunit,$f_bun.),"XX ");
vbar businessunit/response = requestedamount stat = sum datalabel attrid = A ;
xaxis display = (nolabel);
yaxis label = "Amount";
format requestedamount comma32.;
run;
Try SGLABEL and GROUP= option.
ods graphics/noscale;
proc sgplot data=sashelp.class;
vbar age/group=age response=weight seglabel;
run;
Are you using the formatted or unformatted values of the variable in the data attribute map?
Try SGLABEL and GROUP= option.
ods graphics/noscale;
proc sgplot data=sashelp.class;
vbar age/group=age response=weight seglabel;
run;
Got it thanks - added about 3 min after posting.
One other question - with a gridded ods layout I've seen documentation of separate titles for the table and chart on the same page. Any tricks to make this work? I tried title statements in the different ods regions but all I get is one title (over the table) and that's it.
Are you using PROC SGPANEL or SGPLOT ?
I am not sure. But could #byval1 syntax for SGPLOT .
proc sort data=sashelp.class out=class;
by age;
run;
options nobyline;
ods layout gridded columns=2 advance=table;
title 'Age is #byval1';
proc sgplot data=class;
by age;
scatter x=weight y=height;
run;
ods layout end;
I'm using SGPLOT
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.