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.

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!

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
  • 989 views
  • 1 like
  • 2 in conversation