BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ErikLund_Jensen
Rhodochrosite | Level 12

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;

 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

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.

View solution in original post

3 REPLIES 3
DanH_sas
SAS Super FREQ

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

FreelanceReinh
Jade | Level 19

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.

ErikLund_Jensen
Rhodochrosite | Level 12

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.

 

 

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1046 views
  • 2 likes
  • 3 in conversation