BookmarkSubscribeRSS Feed
Schwa
Fluorite | Level 6
I’d like to be able to generate a 3-way frequency table using something like the SPARSE option for PROC FREQ, but only for the last variable present (i.e. I don’t want all possible values for the second variable to also show up for each value of the first variable.)

Is there a way to do this using SPARSE and PROC FREQ, or do I need to do this another way?
2 REPLIES 2
Schwa
Fluorite | Level 6
To clarify: I want counts (including zero counts) for each distinct value of the third variable, but only for combinations of the first two variables that are already present in my data set.
Reeza
Super User
SPARSE will not handle that, you need another way. CLASSDATA is one option or using PROC TABULATE with a format and PRELOADFMT is a good option as well.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1285 views
  • 1 like
  • 2 in conversation