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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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