BookmarkSubscribeRSS Feed
greg6363
Obsidian | Level 7
Is there any way to format the y-axis of a graph creating in PROC FREQ OR PROC SGPLOT? Since I have a large numeric range for the value on my y-axis, I want to add a comma to the numeric format. Instead of presenting the intervals as 10000, 20000, 30000, etc, I want to show them as 10,000, 20,000, 30,000, etc.

Any assistance would be greatly appreciated. Thanks.
4 REPLIES 4
Reeza
Super User
SGPLOT will take the format of the variable and will be much easier to customize compared to the PROC FREQ output.
ballardw
Super User

Example with a data set you should have available:

proc sgplot data=sashelp.cars;
   scatter x=weight y=msrp;
   format msrp comma6.;
   yaxis values=(10000 to 100000 by 10000, 150000, 200000);
run;

 

A YAXIS statement with Values=() option can specify specific values you want to  appear on the axis. Do not list the values with commas though as the comma is used to delimit values in the list.

greg6363
Obsidian | Level 7
The problem is that i’m trying to format the frequency which isn’t a variable in the dataset which means I can’t declare it in a format statement.
ballardw
Super User

So, where is this frequency occurring then?

 

Provide at least some code of what you are currently doing as we a flying pretty blind.

 

In general if you want to make plots best is to create an output data set from whatever procedure and plot that. Then there would be a variable representing a value.

 

Or if you are attempting to manipulate a DATALABEL value then we need more details as some plots will allow setting a format for some data labels.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 4 replies
  • 1317 views
  • 0 likes
  • 3 in conversation