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

Recently, I draw the heatmap with proc sgplot. I found that the every number in cell of heatmap was not align center .

This condition was like this. ref: https://blogs.sas.com/content/iml/2015/08/17/heat-maps-sgplot.html#comment-260274 

thank you.

 

My code:

 

proc format;
value typefmt 1='感染類'  2='壓瘡類'  3='滑脫類'  5='跌倒類';
value quartilefmt 1='P25以前' 2='P25至P50' 3='P50至P75' 4='P75以後' ;run;
ods graphics / imagefmt=png  width=750px  height=800px  ;  
proc sgplot data=a;
heatmap x=type y=quartile / freq=count discretex discretey colormodel=(white cx3883a8 cxff0080 cxff0000 );  /*可用colorresponse=count取代前者的colormodel= */  
styleattrs backcolor=white;
gradlegend / title='freq' titleattrs=(size=12);   
text x=type y=quartile text=count /  splitjustify=center   textattrs=(size=20 color=black);
xaxis label='bbb' labelattrs=(size=12) valueattrs=(size=11);
yaxis discreteorder=data reverse label='aaa' labelattrs=(size=12) valueattrs=(size=11);
title j=c bcolor=cream 'kkkkkk';
format type typefmt.  quartile quartilefmt.;
run;title;
ods graphics off;

 

 

heatmapstmt2.png

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Add the STRIP option to the TEXT statement:

 

text x=type y=quartile text=count / STRIP ...etc...;

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

Add the STRIP option to the TEXT statement:

 

text x=type y=quartile text=count / STRIP ...etc...;

Cingchih
Quartz | Level 8

Thank your for your word 'STRIP'.   ^____^

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1257 views
  • 3 likes
  • 2 in conversation