turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Proc Freq n-way contingency table output

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-11-2010 11:52 AM

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:

PROC FREQ DATA=dataset;

WHERE var8=0;

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

RUN;

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.)

PROC FREQ DATA=dataset;

WHERE var8=0;

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

RUN;

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.)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-11-2010 12:36 PM

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.

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-11-2010 02:12 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-11-2010 02:24 PM

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.

You may need to address the formatting as "Never" and "0" would be treated as distinct values.