BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jimhorne
Obsidian | Level 7
I have a graph where I am displying various numeric values with TEXTPLOT in GTL. My issue is that I have a couple of missing values that are displaying with the standard '.' for numeric missing values. Is there a way I can get it not to show anything rather than showing the dot?
1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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;

 

View solution in original post

5 REPLIES 5
ballardw
Super User

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.

 

 

jimhorne
Obsidian | Level 7

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?

Rick_SAS
SAS Super FREQ

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.

Rick_SAS
SAS Super FREQ

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;

 

jimhorne
Obsidian | Level 7

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-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 2414 views
  • 0 likes
  • 3 in conversation