Hello,
I am trying to generate a 3D chart for percent and need some help to finalize it.
I have tried several things and am not able to remove the extra points in the axis1.
I would also like to:
Add the percent inside each bar values are 50/ 18/32
ID | Greetings |
1 | 1 |
2 | 1 |
3 | 1 |
4 | 1 |
5 | 1 |
6 | 1 |
7 | 1 |
8 | 1 |
9 | 1 |
10 | 1 |
11 | 1 |
12 | 2 |
13 | 2 |
14 | 2 |
15 | 3 |
16 | 3 |
17 | 3 |
18 | 3 |
19 | 3 |
20 | 3 |
21 | 3 |
22 | . |
23 | . |
24 | . |
25 | 2 |
I think the FREQ option in PROC GCHART VBAR3D statement will work.
Generally speaking, 3D charts are a misleading way to display data. See https://medium.com/@purohitpraveen/data-vizualization-why-3d-charts-are-a-terrible-idea-32657fbb928e... You might want to consider the regular old 2D VBAR charts.
Thanks. The link did not work.
Try adding MAJOR=3 to the Axis definition. That forces the appearance of exactly 3 major tick marks. Order affects that the order values are displayed. Major affects the number of displayed tick marks (or Minor the the number of minor ticks between each pair of Major ticks).
Better for many reasons would be to switch to Proc SGPLOT unless you are stuck with a version of SAS 8 or earlier.
Calling @GraphGuy (a.k.a Robert.Allision ) ,since you are asking some special feature with 3D chart.
Or you could try PROC SGPLOT + GTL Annotation Facility (sganno= option) to get this 3D chart, but that need to write many code to finish it.
P.S. Why not use PROC SGPLOT + VBAR to simplify this question as Paige and ballardw pointed out ?
Thank you! It was requested that I create a 3D chart like the one I am showing. I had originally created one with PROC SGPLOT + VBAR as everyone suggested (and it would be my preference) but the graph was seen as too plain.
@Mscarboncopy wrote:
Thank you! It was requested that I create a 3D chart like the one I am showing. I had originally created one with PROC SGPLOT + VBAR as everyone suggested (and it would be my preference) but the graph was seen as too plain.
You should point out that 2D charts are more readable and less likely to produce confusion on the part of the person who is viewing the chart; compared to a 3D chart. The correct link is https://medium.com/@purohitpraveen/data-vizualization-why-3d-charts-are-a-terrible-idea-32657fbb928e
For this case, can you use the DISCRETE option on VBAR3D?
Also, if you interested in a 3D-like look with 2D readability, you could try something like this:
data test;
input value;
cards;
1
1
1
1
2
2
3
3
3
3
3
3
;
run;
proc sgplot data=test;
vbar value / stat=percent dataskin=pressed;
run;
Thank you @DanH_sas This is great.
Is there any way I can add the percentage value to the top of each bar?
Add the DATALABEL option to the VBAR statement. You can also use the FILLATTR=(color=<some color>) if you want to change the color.
@DanH_sasPerfect. Last question. Is there a way to round up the percentage? Right now I have 18.18% and 31.8% for 2 of the value points. I would like to have them display 18% and 32%. Thank you again!
On the SGPLOT statement, set PCTNDEC=0.
@DanH_sas Is there a similar function to round up percentage for
proc Gchart Data want;
vbar3d var/ TYPE=Percent
I've read so much and I can't find a way to be able to round the percentage in this case. I learned how to do everything else I wanted like change the points in the axis, color, width of the bars, add the percent value to the bars. But I can't find a way to round the percentage in this case.
You can do it using the STATFMT option on the VAR3D statement.
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.
Ready to level-up your skills? Choose your own adventure.