BookmarkSubscribeRSS Feed
ballardw
Super User

Goal: Control the text and appearance of the Frequency Missing= message and format of the numeric value displayed at the end of a PROC FREQ one-way table when there are missing values.

For example display "Not Tested = 3,422" in red italics.

I am using SAS 9.2.3 and have looked through a lot of ODS references. I thought this would require modification to the BASE.FREQ.ONEWAYLIST template but the definition doesn't have anything I can see that would control that part.

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

Hi:

  I don't think the "missing" note is controlled within the TABLE template. I think it is text that the procedure writes directly to the output report, as a line of text. I believe that the PROCTITLE style element is used to control the appearance of that piece of the report.

  For example, I can alter the appearance of the missing note in the code below. If you didn't want the actual procedure title (The Freq Procedure) to be on the report, you can disappear it by issuing the ODS NOPTITLE; statement.

cynthia

** make some data with missing values for age;
data makemiss;
  set sashelp.class;
  if age gt 14 then age = .;
run;

  

** establish the path for templates;
ods path work.tmp(update)
         sasuser.templat(update)
         sashelp.tmplmst(read);
 
** create a style template;
proc template;
  define style styles.notefreq;
  parent=styles.sasweb;
  class proctitle /
     fontsize=12pt
     color=red
     fontstyle=italic
     fontweight=bold;
  end;
run;
         
** use new style template;
ods html file='c:\temp\freqmiss.html' style=styles.notefreq;
   
ods ptitle;
proc freq data=makemiss;
  title '1) Procedure Title and missing note both red';
  tables age;
run;
 
ods noptitle;
proc freq data=makemiss;
  title '2) No Procedure Title and only missing note in red';
  tables age;
run;
   
ods _all_ close;

ballardw
Super User

Thank you for this information.

I was really hoping to find something that ODS addresses that would let me change the text displayed as well as how to access the object that contains the number of missing. The advantage of creating a bunch of one-way tables with a single pass of the data isn't going to be there apparently. The MISSPRINT table option doesn't quite work as I wanted to display the missing values somewhat separated. I was hoping to find something like the FMISSING available in the Base.Freq.CrossTabFreqs. Maybe I can find a way to make a crosstab look like a one-way table.

Cynthia_sas
SAS Super FREQ

Hi:

  Got it. Different question than what I thought you were looking for. There is a TABLE template answer -- but only for the TABLE itself, not the note at the bottom of the table.

  If you use MISSPRINT, the missing are included in the report table. To alter this row of information, you can use the CELLSTYLE...AS statement to test wehther FVARIABLE or VARIABLE are missing and if so, change the style of the whole row of the table. To keep things simple, I'm just using the EGDEFAULT style, so you can see the impact of using CELLSTYLE...AS.

cynthia

** use changed table template;

** make some data with missing values for age;

data makemiss;

  set sashelp.class;

  if age gt 14 then age = .;

run;

  

** establish the path for templates;

ods path work.tmp(update)

         sasuser.templat(update)

         sashelp.tmplmst(read);

    

proc template;

   edit Base.Freq.OneWayFreqs;

   notes "One-Way Frequency table";

   parent = Base.Freq.OneWayList;

   

   cellstyle FVariable is missing or Variable is missing

             as {vjust=m background=pink foreground=black

                 fontweight=bold height=.75in};

     

   end;

run;

  

ods listing close;

ods html file='c:\temp\missprint.html' style=egdefault;

        

ods noptitle;

proc freq data=makemiss;

  title '1) Use MISSPRINT and change TABLE Template';

  tables age / missprint;

run;

  

ods _all_ close;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 1417 views
  • 3 likes
  • 2 in conversation