BookmarkSubscribeRSS Feed
BTAinRVA
Quartz | Level 8

Hello Everybody!

 

Is it possible to use a custom fill color in sgplot histogram? The code below using a hex code does not work.

 

proc sgplot data=aviator_demogs nocycleattrs;

histogram age_f18 / fillattrs=(color=#6394A6) name='s' binstart=20 binwidth=2 transparency=0.5;

density age_f18 /type=kernel lineattrs=(color=#6394A6);

histogram age_T45 / fillattrs=(color=LIGB) name='d' binstart=20 binwidth=2 transparency=0.5;

density age_T45 /type=kernel lineattrs=(color=LIGB);

keylegend 's' 'd' / location=inside position=topright across=1 noborder VALUEATTRS = (FAMILY = ARIAL SIZE = 8pt);

yaxis offsetmin=0 VALUEATTRS = (FAMILY = ARIAL SIZE = 8pt);

xaxis display=(nolabel) VALUEATTRS = (FAMILY = ARIAL SIZE = 8pt);

run;

2 REPLIES 2
BTAinRVA
Quartz | Level 8
Figured it out: the hex code needs to be enclosed in quotes.
Rick_SAS
SAS Super FREQ

You can use the 'CX' prefix (instead of '#') to specify hexadecimal colors:

 

proc sgplot data=sashelp.class nocycleattrs;
histogram age / fillattrs=(color=CX6394A6);
run;

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
  • 2 replies
  • 6607 views
  • 0 likes
  • 2 in conversation