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