Help using Base SAS procedures

Three-way tables in Proc Freq not producing "Controlling for ..." text

Reply
Regular Contributor
Posts: 171

Three-way tables in Proc Freq not producing "Controlling for ..." text

When I request submit PROC FREQ code that requests a three-way table, each formatted level of the first named variable produces a separate two-way table of the last two variables named on the Tables statement.  In order for the output to be useful, the formatted value of the first named variable SHOULD BE printed above each constructed table.  I used to get a line saying "Controlling for ..." to indicate what value(s) of the first named variable produced a specified cross-tabulation.  I no longer get the "Controlling for ..." message.

 

I presume that there is some sort of option or environmental variable that is causing the "Controlling for ..." statement to be suppressed.  Any idea what that option/environmental variable might be?

 

For instance, if I have three variables, A, B, and C with A taking on values 1, 2, and 3, and I submit the code:

 

proc freq data=mydata;

  tables a*b*c;

run;

 

I should get three tables of B*C for each of the three levels of A.  The first table should be preceded by the text "Controlling for A=1", the second preceded by "Controlling for A=2", and similarly for the third table.  I do not get such text now.  How do I restore such text?

Super User
Posts: 13,583

Re: Three-way tables in Proc Freq not producing "Controlling for ..." text

Have you are anyone modified the templates use by Proc Freq for tables?

 

Do you have an entry for CROSSTABFREQS in any template path other than in SASHELP.Tmplbase?

In the results window right click on Results and select Templates from the menu. Do you have anything that starts with a name other than SASHELP? If that template repository, likely SASUSER.TMPLAT contains a CROSSTABFREQS that is a likely culprit.

 

Or run this code:

proc template;
   path show;
run;

The default result in the log would look like:

 

1. SASUSER.TEMPLAT(UPDATE)
2. SASHELP.TMPLMST(READ)

If you have another path, especially if it has a lower number than SASHELP.TMPLMST, that may have another CROSSTABFREQS.

 

 

You can set your system to ignore templates not created by SAS by using either

proc template;
   path verify;
run;

Or if you find the modified template ensure that it has this code in the template:

 

      define ControllingFor;                                                  
         dynamic StratNum StrataVariableNames StrataVariableLabels;           
         text "Controlling for" StrataVariableNames / StratNum>0;             
      end;  
Ask a Question
Discussion stats
  • 1 reply
  • 139 views
  • 0 likes
  • 2 in conversation