BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
SASuserlot
Barite | Level 11

I am creating a heatmap. I was using my personal choice of colors, But there are other colors that don't have the name to write in the "Rang attribute Map Dataset"( "rattrap" dataset in my code). How Can I use the different colors using the color hex codes or any other codes? I tried replacing color codes with color names, but it didn't work. thank you for your suggestions and help.

Present output:

SASuserlot_0-1711653244065.png

 

 

This are the colors I want to use instead of present colors in my output

SASuserlot_0-1711653086145.png

proc freq data = sashelp.cars noprint;
table origin*type / out = cars(keep = count origin type);
run;

data attrmap;
retain id "myid";
length min 4. max $5.;
input min max $ color $;
datalines;
0 10 green
11 20 yellow
21 75 orange
76 _max_ red
;
run;

ods html;
proc sgplot data=cars rattrmap=attrmap  noautolegend;
heatmapparm x=origin y=type
colorresponse=count/ rattrid=myid outline name='range';
text x=origin y=type text=count / textattrs=(size=8pt);
gradlegend 'range'/title= 'Range of cars';
yaxis fitpolicy=split label="Type";
xaxis label="Origin";
run;
ods html close;

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

Replace the "#" with "cx" (e.g. #000000 becomes cx000000)

View solution in original post

2 REPLIES 2
DanH_sas
SAS Super FREQ

Replace the "#" with "cx" (e.g. #000000 becomes cx000000)

SASuserlot
Barite | Level 11

Perfect. It worked. Thanks

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 2 replies
  • 665 views
  • 1 like
  • 2 in conversation