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

Hi I'm trying to produce a histogram within SAS for education.

I tried using proc sgplot but was unable to make the intervals at the edges not the centre.

 

So I tried using proc univariate but was unable to label my axis.

 

Is it possible to do both?

 

proc univariate data=SASUSER.DATA1;
histogram sales2015 / endpoints=(0 to 16000 by 2000);
run;

 

proc sgplot data=SASUSER.DATA1;

histogram sales2015 / nbins=7 binstart=1000 binwidth=2000 SHOWBINS ;
xaxis label="Sales in 2015";

yaxis grid;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Your xaxis? Apply a label to the variable and it will pass through to the PROC.

 

label sales2015 = 'My axis title';

View solution in original post

6 REPLIES 6
Reeza
Super User

Your xaxis? Apply a label to the variable and it will pass through to the PROC.

 

label sales2015 = 'My axis title';
rebeccabarton
Fluorite | Level 6

Thanks, this is perfect. Is it also possible to change my chart title?

Reeza
Super User

Sure. In the HISTOGRAM statement you can add the ODSTITLE.

 

histogram .... / endpoints=(....) odstitle = 'MY GRAPH TITLE';
rebeccabarton
Fluorite | Level 6

thank you so much,

 

sorry final question, is it possible to just display the histogram and not all the additional data?

Reeza
Super User

Note: I've moved your post to the Graphs forum as it relates more to graphing than SAS Studio and I have changed your subject line to be more descriptive. You can undo any of these changes if you feel they are not appropriate. 

Rick_SAS
SAS Super FREQ

Yes. You can control the location of the ticks and whether the labels occur at the end of the bins or in the middle of a bin. Follow the instructions and examples at "Choosing bins for histograms in SAS."

 

The same examp[le shows how to display titles In PROC UNIVARIATE by using the ODSTITLE= and ODSTITLE2= options. 

You can refer to the contents of the TITLE and TITLE2 global statements, our you can specify a string:

histogram X / odstitle="Main title" odstitle2="minor title";

 

 

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 6 replies
  • 20459 views
  • 5 likes
  • 3 in conversation