I have a simple stacked bar chart reporting gender by year and the yaxis grid value is 0-100 by 20. The 100 is being replaced by two asterisks no matter what I do to adjust the text size, graph size, etc. I have an identical graph reporting race by year (white vs. black vs. other) - all configurations are identical with the exception of group, and this issue does not appear. I think it has something do with the space between the y values and the axis label. I am running 9.4 TS1M4 on a 32-bit W10 machine. Code is below:
options nocenter;
ods graphics / noborder width=1500 height=900;
ods proclabel="Suppression Cohort: Deaths by Year - Gender";
ods noproctitle;
ods listing gpath="%sysfunc(getoption(work))";
proc sgplot data=dyrsuppgenderfreq noborder nowall ;
vbar dthyearprint / group=gender response=pct barwidth=.50 seglabel seglabelattrs=(size=9 family=arial color=white weight=bold) baselineattrs=(thickness=0)
dataskin=matte;
xaxis values=('< 2010' '2010-present') valueattrs=(size=12 family=arial) label="Year of Autopsy" labelattrs=(size=17 family=arial);
yaxis valueattrs=(size=16 family=arial) label='% Particpant Deaths' labelattrs=(size=17 family=arial) GRID VALUES = (0 TO 100 BY 20);
keylegend / title=""
titleattrs=(Size=14)
valueattrs=(Family=Arial Size=14);
run;
title;
And here is the code for the race by year graph:
options nocenter;
ods graphics / noborder width=1500 height=900;
ods proclabel="Suppression Cohort: Deaths by Year - Race";
ods noproctitle;
ods listing gpath="%sysfunc(getoption(work))";
proc sgplot data=dyrsuppracefreq noborder nowall ;
vbar dthyearprint / group=race response=pct barwidth=.50 seglabel seglabelattrs=(size=9 family=arial color=white weight=bold) baselineattrs=(thickness=0)
dataskin=matte;
xaxis values=('< 2010' '2010-present') valueattrs=(size=12 family=arial) label="Year of Autopsy" labelattrs=(size=17 family=arial);
yaxis valueattrs=(size=16 family=arial) label='% Participant Deaths' labelattrs=(size=17 family=arial) GRID VALUES = (0 TO 100 BY 20);
keylegend / title=""
titleattrs=(Size=14)
valueattrs=(Family=Arial Size=14);
run;
title;
Most of the time a displayed set of ** for a numeric variable means that the current format that is assigned to the variable has issues with attempting to display the value.
The following example shows what happens when you try to force a 3 digit value into 2 display digits.
Data example; x=100; run; proc print data=example; format x f2.; run;
The BEST formats sometimes can get around the space limit by shifting to scientific notation but still need at least 3 characters. If you use a fixed field like the F format (or simple 2.) there is not enough room. Also if you try to display dates past year 9999 you run into issues with the formats not wanting to display the year and you get *********** type results. Most people don't worry about the date limitation though on the high end.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.