BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
msrenee1984
Obsidian | Level 7
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;

msrenee1984_0-1709125817258.png

 

 

msrenee1984_1-1709125880303.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

I think now you need to increase the WIDTH value in the ODS GRAPHICS statement.

View solution in original post

7 REPLIES 7
FreelanceReinh
Jade | Level 19

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).

msrenee1984
Obsidian | Level 7

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;

msrenee1984_0-1709132837757.png

 

 

 

 

FreelanceReinh
Jade | Level 19

I think now you need to increase the WIDTH value in the ODS GRAPHICS statement.

msrenee1984
Obsidian | Level 7
this resolved my issue thank you!!
FreelanceReinh
Jade | Level 19

@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.
show_option_menu.png

ballardw
Super User

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.

 

 

msrenee1984
Obsidian | Level 7
thank you it reads much better now!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 7 replies
  • 719 views
  • 5 likes
  • 3 in conversation