the easiest way is to apply a format.
Is the TEXT= variable numeric or character? If character, you can replace "." with " ".
If numeric, then presumably you are using the PERCENT. format to produce those percentages.
Create a new format like this:
proc format;
value missfmt .=' '
other = [percent7.];
run;
For example, here is some fake numeric data and a template:
proc template;
define statgraph textplot;
begingraph;
layout overlay / yaxisopts=(offsetmin=0.05 offsetmax=0.05);
textplot x=x y=y text=z / name='textplot1'
display=all
textattrs=(weight=bold) fillattrs=(transparency=0.9)
group=sex groupdisplay=cluster clusterwidth=1;
discretelegend 'textplot1';
endlayout;
endgraph;
end;
run;
data A;
do x = 1 to 3;
do y = 1 to 5;
z = x/y;
if x = y then z=.;
output;
end;
end;
format z percent7.;
run;
proc format;
value missfmt .=' '
other = [percent7.];
run;
proc sgrender data=A template=textplot;
format z missfmt.;
run;
Easiest to test would likely be using
Options missing=' ';
prior to the procedure generating the output.
Remember to set it back after you no longer need the blank for missing.
Much to my surprise, that had no effect. I get the same graph with OPTIONS MISSING='' ; as I do with the default.
Any other ideas?
OPTIONS MISSING=" "; does not apply to the GTL graphs. You have to either recode the data or apply a format, as I described in my response.
the easiest way is to apply a format.
Is the TEXT= variable numeric or character? If character, you can replace "." with " ".
If numeric, then presumably you are using the PERCENT. format to produce those percentages.
Create a new format like this:
proc format;
value missfmt .=' '
other = [percent7.];
run;
For example, here is some fake numeric data and a template:
proc template;
define statgraph textplot;
begingraph;
layout overlay / yaxisopts=(offsetmin=0.05 offsetmax=0.05);
textplot x=x y=y text=z / name='textplot1'
display=all
textattrs=(weight=bold) fillattrs=(transparency=0.9)
group=sex groupdisplay=cluster clusterwidth=1;
discretelegend 'textplot1';
endlayout;
endgraph;
end;
run;
data A;
do x = 1 to 3;
do y = 1 to 5;
z = x/y;
if x = y then z=.;
output;
end;
end;
format z percent7.;
run;
proc format;
value missfmt .=' '
other = [percent7.];
run;
proc sgrender data=A template=textplot;
format z missfmt.;
run;
Thanks, Rick, that gave me what I needed! A little manipulation of an existing FORMAT (I didn't realize/remember that missing is valid), a little adjusting of the attribute map going against that graph and it works wonderfully. But your format pointer was the key!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.