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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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