BookmarkSubscribeRSS Feed
Forward
Calcite | Level 5

I am using sas 9.4 on a 64-bit machine. I have a dataset like this

data totals;

length dept $ 7 site $ 8 tx_sale $20 ;

INFILE DATALINES DLM='#';

input dept site quarter sales tx_sale ;

datalines ;

Parts#Sydney#1#0# N/A#

Parts#Atlanta#1#50##

Parts#Paris#1#60# #

Tools#Shanghai#4#0#N/A#

Tools#Athen#4#35##

Tools#Pittsburg#4#48##

;

run;

And I want to generate a bar chart with datalabel I specified in column tx_sale and the color of the bar indicating dept

I used code below:

proc sgplot data=totals;
  hbar site / response=sales missing datalabel=tx_sale;
run;

The chart generated by the code didn't have the color

If I used code below :

proc sgplot dat=totals;

  hbar site / group=dept response=sales missing datalabel=tx_sale;

run;

The chart generated by the code didn't have the datalabels.

How can I have both color bar and data label on the same chart? Thank you

2 REPLIES 2
DanH_sas
SAS Super FREQ

On the VBAR statement, add GROUPDISPLAY=CLUSTER. The bar will not be stacked, but your labels should appear. Will that work for you?

Forward
Calcite | Level 5

Yes, it works. Thank you very much!

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 2 replies
  • 2534 views
  • 0 likes
  • 2 in conversation