BookmarkSubscribeRSS Feed
stancemcgraw
Obsidian | Level 7

Hi all,

 

   I have the following code that correctly produced three histograms by group.

However, I would

1) like to change the color of the bars (fill black)

2) change the x axis label from Npo_mean to Hours NPO:.

3) Change and clarify the Y-axis group labels

 

The graph output is attached below as well

 

proc univariate data=tube.survival2;

 

  class npogroup ;

  var Hours;      /* computes descriptive statisitcs */

  histogram Hours  / odstitle="Distribution of NPO by Fasting Category"

 vscale=percent vaxis=0 to 60 by 10 normal 

 nrows=3 midpoints=(0 to 22 by 2) ;

   

  ods select histogram; /* display on the histograms */

  INSET N = 'Number of patients' MEDIAN  MEAN  /position=ne ;

 

run;

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

If the histogram(s) is all you are interested in, I suggest you use PROC SGPLOT/SGPANEL instead. Gives you more control over the visual attributes of the plot.

stancemcgraw
Obsidian | Level 7

Would you know the code to reproduce what I did above for sgplot?

PeterClemmensen
Tourmaline | Level 20

I can't see your data, but this should get you in the right direction. 

 

title 'Your Title Here';
proc sgpanel data=sashelp.iris noautolegend;
   panelby Species / columns=1;
   histogram SepalLength / fillattrs=(color=green);
   density SepalLength / lineattrs=(color=black);
   colaxis label='Label Here';
run;
title;

You can find all the information you need in the PROC SGPANEL Documentation.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2615 views
  • 1 like
  • 2 in conversation