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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.