proc freq data=r.fac2;
tables facility*year / norow nocol nopct
sparse out=FreqOut(where=(percent^=.));
run;
proc print data=FreqOut;
var facility year Count;
run;
/* Create heat maps of the tabular results */
ods graphics / width=400px;
title "shoes in Facility by Year ";
title2 "sneakers (N=5952)";
/* basic heat map */
proc sgplot data=FreqOut;
heatmap x=year y=facility / freq=Count
discretex discretey
colormodel=(green redTwoColorRamp)outline;
run;
I think now you need to increase the WIDTH value in the ODS GRAPHICS statement.
Hello @msrenee1984,
You can increase the height of the plot (and thus the length of the y-axis) by adding the HEIGHT= option (with a suitable value) to the ODS GRAPHICS statement, e.g.
ods graphics / width=400px height=1000px;
and/or decrease the font size of the tick mark labels by specifying a smaller value in the SIZE= suboption of the VALUEATTRS= option of the YAXIS statement, e.g.
yaxis valueattrs=(size=6pt);
(to be inserted in your PROC SGPLOT step).
If you want to change the order of the tick marks (note that the facilities with count=0 in 2019 appear at the top, which you may or may not like), add a VALUES= option to the YAXIS statement. You can create the list for this option, e.g., with SELECT INTO in PROC SQL, so you don't need to type all those names (or numbers if they are formatted values).
first: thank you very much for responding! your solution solved my missing Y-axis problem!! however now the years are hidden on the X-axis. Can you check over my code I'm sure I've written something incorrectly.
/* Create heat maps of the tabular results */
ods graphics / width=400px height=2000px;
title "apples Per Facility by Year ";
title2 "apple Counts (N=5952)";
/* basic heat map */
proc sgplot data=FreqOut;
heatmap x=year y=facility / freq=Count
discretex discretey colormodel=(green redTwoColorRamp)outline ;
yaxis label='Facility Name' valueattrs=(size=6pt) labelattrs=(size=7pt);
xaxis label='year' valueattrs=(size=6pt) labelattrs=(size=7pt);
run;
I think now you need to increase the WIDTH value in the ODS GRAPHICS statement.
@msrenee1984 wrote:
this resolved my issue thank you!!
Glad to hear this. You're welcome. Actually, for later readers of this thread it would make more sense if my first reply was marked as the solution, not the second one. May I ask you to change that? It's quite easy: Select the other post as the solution after clicking "Not the Solution" in the option menu (see icon below) of the current solution.
PX is often a poor unit to use for graph size as it is dependent on a rendering device display settings. What may appear reasonable on one screen can become extremely large (low resolution screen) or small (very high resolution screen) when shown on another device.
For more understandable units use CM MM or IN so a human has a chance of understanding what size you intend.
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!
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.
Ready to level-up your skills? Choose your own adventure.