Show the code you are using for your heatmap. Since there enough options involved I don't want to spend time trying to guess which approach you started with. The options you have chosen may well influence other options needed.
A description of what color you want where may help as well. There are multiple ways to assign colors
Example data that will run your heatmap would be a good idea. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the <> icon or attached as text to show exactly what you have and that we can test code against.
Well, WHITE is a color, but I guess you are saying you want a non-white color for the missing cells.
I assume your current program looks like the following. Notice that I am using the HEATMAPPARM statement, which assumes the data are presummarized:
data Have; input ID Diet Day; datalines; 1 0 0 1 0 2 1 1 3 2 1 1 3 0 1 4 1 0 5 0 2 5 2 3 ; title "A Heat Map"; proc sgplot data=Have; heatmapparm x=Day y=ID colorgroup=Diet; run;
To add color to the missing cells, you need to explicitly add the coordinates of the cells and use a missing value for the DIET variable. THe following code creates a grid of missing values and then merges the data with the grid so that your observed values overwrite the missing values:
/* create grid of missing values */ data Missing; do ID = 1 to 5; do Day = 0 to 3; Diet = .; output; end; end; run; /* merge with observed data */ data Combine; merge Missing Have; by ID Day; run; /* for consistent results, you might want to sort by the response var */ proc sort data=Combine; by Diet; run; title "A Heat Map"; proc sgplot data=Combine; heatmapparm x=Day y=ID colorgroup=Diet / outline; keylegend; run;
The color of the missing cells is the GraphMissing style element in the current ODS style.
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.
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.