New SAS User

Completely new to SAS or trying something new with SAS? Post here for help getting started.
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
iatoloye
Fluorite | Level 6

Hello All,

 

The code below was posted by JeffMeyers and it was super helpful. But I need help increasing the font size of the x- and y-axis. The font size in the output graph is small.

 

data work.Almtarfi_2;
input Cult Biomass_BRC Biomass_RB yield_BRC Yield_RB Height_BRC Heigh_RB;
CARDS;
1930 62.125 75.255 2563.16 2196.06 123.075 142.8
1933 60.62 77.91 2396.49 1965.79 106.233 124.325
1935 51.275 77.2 2317.14 2490.56 114.75 137.25
1940 63.31 73.025 2738.19 2888.38 142.85 169.5



/*Code below by Chris Hemedinger, found on the SAS blogs*/
ods trace off;
/* Prepare the correlations coeff matrix: Pearson's r method */
%macro prepCorrData(in=,out=);
/* Run corr matrix for input data, all numeric vars */
ods select none; ods noresults;
ods output PearsonCorr=blah;
proc corr data=&in. pearson 
outp=work._tmpCorr
vardef=df
;
run;
ods results;
ods select all;
proc sql noprint;
    select variable into :vlist separated by '|' from blah;
quit;
/* prep data for heat map */
data &out.;
keep x y r p;
set blah (rename=(variable=_name_));
*set work._tmpCorr(where=(_TYPE_="CORR"));
array v{*} %do i = 1 %to %sysfunc(countw(%superq(vlist),|)); %scan(%superq(vlist),&i,|) %end;;
array pval{*} %do i = 1 %to %sysfunc(countw(%superq(vlist),|)); p%scan(%superq(vlist),&i,|) %end;;
x = _NAME_;
do i = dim(v) to 1 by -1;
y = vname(v(i));
r = v(i);
p = pval(i);

/* creates a lower triangular matrix */
if (i<_n_) then do;
r=.;p=.;
end;
output;
end;
run;

proc datasets lib=work nolist nowarn;
delete _tmpcorr;
quit;
%mend;
options mprint;
/* Create a heat map implementation of a correlation matrix */
ods path work.mystore(update) sashelp.tmplmst(read);

proc template;
define statgraph corrHeatmap;
dynamic _Title;
begingraph;
entrytitle _Title;
rangeattrmap name='map';
/* select a series of colors that represent a "diverging" */
/* range of values: stronger on the ends, weaker in middle */
/* Get ideas from http://colorbrewer.org */
range -1 - 1 / rangecolormodel=(cxD8B365 cxF5F5F5 cx5AB4AC);
endrangeattrmap;
rangeattrvar var=r attrvar=r attrmap='map';
layout overlay /
xaxisopts=(display=(line ticks tickvalues))
yaxisopts=(display=(line ticks tickvalues));
heatmapparm x = x y = y colorresponse = r /
xbinaxis=false ybinaxis=false
name = "heatmap" display=all;
textplot x=x y=y text=p;
continuouslegend "heatmap" /
orient = vertical location = outside title="Pearson Correlation";
endlayout;
endgraph;
end;
run;

/* Build the graphs */
ods graphics /height=600 width=800 imagemap;

%prepCorrData(in=work.Almtarfi_2,out=work.Almtarfi_r);
proc sgrender data=work.Almtarfi_r template=corrHeatmap;
dynamic _title="Correlation matrix for all variables";
run;

 Thanks! 

1 ACCEPTED SOLUTION

Accepted Solutions
iatoloye
Fluorite | Level 6

Thanks for the suggestion. I made the following additions but the tick labels did not change and I did not receive any error in the log. The additions are in bold.

xaxisopts=(display=(line ticks tickvalues) labelattrs=(weight=bold size=30pt family="Arial"))
yaxisopts=(display=(line ticks tickvalues) labelattrs=(weight=bold size=30pt family="Arial"));

Any suggestion?

View solution in original post

2 REPLIES 2
ballardw
Super User

Add to the Xaxisopts or Yaxisopt

 

labelattrs = (size= fontsize)

 

font size (without the <could reference a Style attribute, to change as your ods style changes, or a number and dimension unit of measure such as CM, MM, IN ( Inches),  PT (points) PX (pixels) or PCT.

Pixels change in relation to display/image type so can be a tad flaky to set.

iatoloye
Fluorite | Level 6

Thanks for the suggestion. I made the following additions but the tick labels did not change and I did not receive any error in the log. The additions are in bold.

xaxisopts=(display=(line ticks tickvalues) labelattrs=(weight=bold size=30pt family="Arial"))
yaxisopts=(display=(line ticks tickvalues) labelattrs=(weight=bold size=30pt family="Arial"));

Any suggestion?

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 2292 views
  • 0 likes
  • 2 in conversation