BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
HitmonTran
Pyrite | Level 9

Hello,

 

I need to make a simple bar graph that looks like this:

HitmonTran_0-1693469823773.png

 

sample data:

order (num)var2 (char)var3 (char)var4 (num)
1No Symptomsscreening23
1Symptoms1screening244
1Symptoms 2screening25
2No Symptomsvisit 2050
2Symptoms1visit 2070
2Symptoms 2visit 2030
3No Symptomsscreening23
3Symptoms1screening244
3Symptoms 2screening25
4No Symptomsvisit 2050
4Symptoms1visit 2070
4Symptoms 2visit 2030

 

                                                

 1
1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
/*
Here is an example
*/
title;
proc sgplot data=sashelp.heart;
vbar bp_status/response=weight group=sex groupdisplay=cluster;
run;

Ksharp_0-1693484371150.png

 

View solution in original post

5 REPLIES 5
Amir
PROC Star

Hi,

 

Please share what you have tried with any messages from the log. You can use the Insert Code "</>" icon when posting code or log messages.

 

 

Thanks & kind regards,

Amir.

Ksharp
Super User
/*
Here is an example
*/
title;
proc sgplot data=sashelp.heart;
vbar bp_status/response=weight group=sex groupdisplay=cluster;
run;

Ksharp_0-1693484371150.png

 

HitmonTran
Pyrite | Level 9
Thanks Ksharp! you always give me the correct solution on 1st attempt. really appreciate your help!
ballardw
Super User

Since the example "data" has nothing that appears in the example picture you have to walk us through the role of each variable and how it is supposed to be used in the graph. Especially what your Var4 represents. You show an example graph where bar height represents percentages. If the value of Var4 is a percentage then 244 is an odd value, not impossible but appears odd.

 

I believe you have been on this forum long enough to know that example data should be in form of working data step code so we don't have to make guesses about actual variable names and types.

xxformat_com
Barite | Level 11

hi,

Prefer vbarbasic of proc sgplot over the old vbar. You will have more features, flexibility and you will be able to compute your statistics with proc freq or so before plotting them.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 475 views
  • 2 likes
  • 5 in conversation