Hello,
I need to make a simple bar graph that looks like this:
sample data:
order (num) | var2 (char) | var3 (char) | var4 (num) |
1 | No Symptoms | screening | 23 |
1 | Symptoms1 | screening | 244 |
1 | Symptoms 2 | screening | 25 |
2 | No Symptoms | visit 20 | 50 |
2 | Symptoms1 | visit 20 | 70 |
2 | Symptoms 2 | visit 20 | 30 |
3 | No Symptoms | screening | 23 |
3 | Symptoms1 | screening | 244 |
3 | Symptoms 2 | screening | 25 |
4 | No Symptoms | visit 20 | 50 |
4 | Symptoms1 | visit 20 | 70 |
4 | Symptoms 2 | visit 20 | 30 |
1 |
/*
Here is an example
*/
title;
proc sgplot data=sashelp.heart;
vbar bp_status/response=weight group=sex groupdisplay=cluster;
run;
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.
/*
Here is an example
*/
title;
proc sgplot data=sashelp.heart;
vbar bp_status/response=weight group=sex groupdisplay=cluster;
run;
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.
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.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: