BookmarkSubscribeRSS Feed
Kamohelo_A
Calcite | Level 5

Hi

 

I am trying to create a sas bargraph that one can then filter on to view specific items.

 

Suppose the x-axis is the individual number of passes and the y-axis is the count. Then:

Proc Sgplot Data = Inputs;

      Vbar  = individual_ID;

Run; 

should give me that noting that the individual might say play tennis, rugby, soccer and chess then I can add a Group = sport to get a single bar for an individual with stacks on it?

 

But say I want to filter on just rugby and still track the individual number in the x-axis.

Then finally, what if I want to filter on just on individual number to view more detail into them only across the various sports.

 

Kindly assist on the latter components

 

 

1 REPLY 1
PaigeMiller
Diamond | Level 26

@Kamohelo_A wrote:

Hi

 

I am trying to create a sas bargraph that one can then filter on to view specific items.

 

Suppose the x-axis is the individual number of passes and the y-axis is the count. Then:

Proc Sgplot Data = Inputs;

      Vbar  = individual_ID;

Run; 

should give me that noting that the individual might say play tennis, rugby, soccer and chess then I can add a Group = sport to get a single bar for an individual with stacks on it?


There is no equal sign after the VBAR in the VBAR statement. The option GROUP= will add in the sports that the person plays. Is there some reason why you need to ask? You can just run the code and see what happens.

 

But say I want to filter on just rugby and still track the individual number in the x-axis.

 

Add this command into PROC SGPLOT.

 

where sport='Rugby';

 

Then finally, what if I want to filter on just on individual number to view more detail into them only across the various sports.


Similar solution

where individual_id=7;

Bar charts seem to be a poor choice for displaying this information. A frequency table makes more sense to me (PROC FREQ)

--
Paige Miller

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

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
  • 1 reply
  • 1253 views
  • 0 likes
  • 2 in conversation