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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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