Help using Base SAS procedures

Proc Freq n-way contingency table output

New Contributor
Posts: 3

Proc Freq n-way contingency table output

I'm a student of SAS trying to obtain an n-way contingency table with 7 variables. I'm not even sure what that is supposed to look like with so many variables, but I'm working with the requirement to use PROC FREQ and the CROSSLIST option. Also, I can only use the observations that have 0 as the value for variable var8. This is what I'm trying:

WHERE var8=0;
TABLES var1*var2*var3*var4*var5*var6*var7 / crosslist nocum nopercent norow nocol;

My output is a mess. The tables aren't really tables and they say they're controlling for var1 through var5 while showing info for var6 and var7. I get 11 pages that says it has 32 tables but only a few are graphic. The rest just say "Table # of var6 by var7. Controlling for var through var5."

I think the problem may be with the formatting of the variables. For example, var1 can either be "Never" or 0. Var 2 is "Once" or 0. Should I change the format? I don't get errors in the Log right now.

The statements I'm using are just like what I'm seeing in many examples so I'm confused. Any assistance is appreciated!

(I'm using SAS 9.2.)
Super Contributor
Posts: 281

Re: Proc Freq n-way contingency table output

I have never seen a 7-dimensional table. I imagine it would be hard to fit into two-dimensional output format like a SAS Listing.

So when PROC FREQ gives you output like you described, I suspect that's the best that can be done. The problem you are facing is not the formatting of the variables.
New Contributor
Posts: 3

Re: Proc Freq n-way contingency table output

Ok, thanks Paige! I was racking my brain trying to imagine how that could work. I'll have to find another way to get the results I need.
Trusted Advisor
Posts: 2,113

Re: Proc Freq n-way contingency table output

Another way that might get a sufficient display is with PROC TABULATE. I've not used it for 7 variables, but have gotten up to 4 or 5.

You may need to address the formatting as "Never" and "0" would be treated as distinct values.
Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation