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.

 

 

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

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

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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