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

Hello, I need to create a bullet graph by category. I have actual sales and predicted sales for individual products and the are grouped by category. I would like to use different colors for each category and in the legend show only actual and predicted sales. When I used ssgpanel, the p[roblem I'm facing is that the products in one category is also appearing in other category. Please see below for a reproducible example. I'm using SAS 9.3.

My question is: how can I create a bullet graph by data driven color schemes ?

data sales;

  input cat $ product $ actual predict;

  datalines;

  X A 10 5

  X B 12 15

  X C 15 18

  X D 13 20

  Y E 20 15

  Y F 22 25

  Y G 25 38

  Y H 23 40

  ;

run;

data attrs;

input id $ value $ fillcolor $;

datalines;

my_id X blue

my_id Y red

;

run;


proc sgpanel data = sales dattrmap=attrs;

  PANELBY cat/LAYOUT=  rowlattice;

  hbar product/response = actual group = cat attrid=my_id ;

  hbar product/response = predict group = cat BARWIDTH =0.2 FILLATTRS = (color = black) ;

run;




Products E,F,G and H appear in cat x even though cat x does not have these products vice versa.

SGPanel.png

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

Add UNISCALE=COLUMN to the PANELBY statement, and you should get what you want.

View solution in original post

2 REPLIES 2
DanH_sas
SAS Super FREQ

Add UNISCALE=COLUMN to the PANELBY statement, and you should get what you want.

Forecaster
Obsidian | Level 7

Thank you this worked perfectly.

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
  • 752 views
  • 0 likes
  • 2 in conversation