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.
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.