BookmarkSubscribeRSS Feed
romangelzhaeuse
Fluorite | Level 6

Hi,

 

I want to generate various histograms using the by statement and assign different colors to each histogram. Is there a method analogous to proc boxplot's cvref which works?

 

I mean something similar to the below code:

 

ods select Histogram;
proc univariate data=Simon4;
	histogram IL6A / cboxfill=MF_IL6                 
		midpoints =0 50 100 150 200 250 300;
	var IL6A;
	by Gruppe;
run;

where "MF_IL6" is variable giving the colors for different by groups.

1 REPLY 1
DanH_sas
SAS Super FREQ

How about something like this?

 

title "Cholesterol by Weight Status";
proc sgpanel data=heart noautolegend;
panelby weight_status / novarname columns=1;
histogram cholesterol / group=weight_status;
run;

 

The SGPanel Procedure

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 1 reply
  • 881 views
  • 0 likes
  • 2 in conversation