Hi community.
I can't find a way to format frequency values in proc gchart. I made the following example with automatic midpoint values 10000, 20000 etc, and I want the values formatted with commax12.0, so the values are shown as 10.000, 20.000 etc. Any help would be much appreciated.
* Make some test data;
data have (drop=i);;
do afd = 'Adf1','Afd2','Afd3','Afd4';
do j = 1 to ranuni(3)*50000;
output;
end;
end;
run;
* Plot afd / frequency;
proc gchart data=have;
hbar afd / type=freq;
run;
quit;
Hi @ErikLund_Jensen,
You can use the STATFMT= option of the HBAR statement:
hbar afd / type=freq statfmt=commax12.;
It applies to the frequency table as well, except for the percentages, though.
Try this instead:
proc sgplot data=have;
xaxis valuesformat=commax12.;
hbar afd;
yaxistable afd / stat=freq;
yaxistable afd / stat=percent;
run;
Hope this helps!
Dan
Hi @ErikLund_Jensen,
You can use the STATFMT= option of the HBAR statement:
hbar afd / type=freq statfmt=commax12.;
It applies to the frequency table as well, except for the percentages, though.
Thanks to @DanH_sas and @FreelanceReinh for input.
Proc sgplot seems a good alternative to gchart, but it would be rather complicated to change to a new procedure with a different syntax in several reports, where most of the formatting and layout control is in macro variables.
So I am very happy that it could be done with a minor change to Proc gchart.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.