BookmarkSubscribeRSS Feed
msas
Calcite | Level 5
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.)
3 REPLIES 3
Paige
Quartz | Level 8
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.
msas
Calcite | Level 5
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.
Doc_Duke
Rhodochrosite | Level 12
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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1151 views
  • 0 likes
  • 3 in conversation