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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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