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-2024.png

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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