BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Doug____
Pyrite | Level 9

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;

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Try SGLABEL and GROUP= option.

 

ods graphics/noscale;
proc sgplot  data=sashelp.class;
vbar age/group=age response=weight seglabel;
run;

View solution in original post

5 REPLIES 5
Reeza
Super User

Are you using the formatted or unformatted values of the variable in the data attribute map?

 

Ksharp
Super User

Try SGLABEL and GROUP= option.

 

ods graphics/noscale;
proc sgplot  data=sashelp.class;
vbar age/group=age response=weight seglabel;
run;
Doug____
Pyrite | Level 9

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. 

Ksharp
Super User

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;

 

 

 

 

Doug____
Pyrite | Level 9

I'm using SGPLOT

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1649 views
  • 2 likes
  • 3 in conversation