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