BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
CLE
Obsidian | Level 7 CLE
Obsidian | Level 7

Hi,

I'm building a PLOT SGPLOT HEATMAP with TEXT to label the values. I need anywhere the value is zero for the text to be white or omitted without dropping the row from the heatmap.

 

The values were originally missing, but I made them zero so that the row did not get dropped (when all were missing values). 

 

Any help or guidance is appreciated. SAS EG version 7.1  SAS 9.4M4 (I think)

 

 

Data Table : Ordering 

DelayWK_ENDING_DTSum_NbrNbr_Revised
AAA22Jun2018252.803253
AAA29Jun20182.33312
AAA06Jul2018635.9472636
AAA13Jul2018 0
BBB22Jun2018809.6699810
BBB29Jun2018 0
BBB06Jul201854.15354
BBB13Jul2018 0
CCC22Jun201814420.736514,421
CCC29Jun20181401.07751,401
CCC06Jul201811280.822911,281
CCC13Jul20184882.63664,883
DDD22Jun201870.787971
DDD29Jun201825.71326
DDD06Jul2018 0
DDD13Jul2018310.3668310
EEE22Jun2018 0
EEE29Jun2018 0
EEE06Jul201827.6328
EEE13Jul2018 0
FFF22Jun2018 0
FFF29Jun20 0
FFF06Jul2018 0
FFF13Jul2018 

0

proc sgplot data=work.ordering noautolegend noborder nowall noopaque ;
heatmap x=WK_ENDING_DT y=DELAY / weight=nbr_revised  colormodel=(white white yellow orange lightred) 
outline discretex discretey y2axis;
	text x=wk_ending_dt y=delay text=nbr_revised / textattrs=(size=11pt family='helvetica' 
style=normal color=black) strip fillattrs=(color=white );
	yaxis display=(noticks nolabel novalues ) reverse;
	y2axis labelattrs=(size=14pt family="Arial Narrow" )labelpos=center display=(noticks nolabel) reverse 
valueattrs=(size=11pt family='arial narrow' style=normal color=black) fitpolicy=none;
xaxis label="Week Ending Date" labelattrs=(size=14pt family='arial narrow' style=normal  ) 
labelpos=center display=(noticks);
	format wk_ending_dt date7.;
	TITLE h=12pt bold BL=YES BCOLOR=white c=black j=left f=arial "Make my Zeros Turn White";
run;

 

Output: I need zeros to not show up in the chart output.

 

SAS TEST FILE IMAG.jpg

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Try this:

1. In the data, create a new variable

TEXTCOLOR = (NBr_Revised > 0);

2. On the TEXT statement in SGPLOT, use 

COLORRESPONSE=TextColor ColorModel=(White Black);

View solution in original post

3 REPLIES 3
Rick_SAS
SAS Super FREQ

Try this:

1. In the data, create a new variable

TEXTCOLOR = (NBr_Revised > 0);

2. On the TEXT statement in SGPLOT, use 

COLORRESPONSE=TextColor ColorModel=(White Black);

CLE
Obsidian | Level 7 CLE
Obsidian | Level 7

That worked great!  I appreciate the help. 

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
  • 3 replies
  • 1250 views
  • 1 like
  • 3 in conversation