I have a few series of variables, each with a particular set of value options, where I need to display one of the answer options for each one (percent with that option), as a cross tab against another variable. While this is relatively easy to do using proc freq or proc tabulate, rather than a series of tables that shows all the options, I would like to display this, one table for each set of variable (those sharing value options). Something like this:
| % F | |||||
| Total | Admin | Library | Maintenance | Support | |
| Sat | 0.4 | 0.5 | 0.5 | 0.3 | 0.3 |
| Engage | 0.4 | 0.5 | 0.5 | 0.3 | 0.3 |
| Clear | 0.3 | 0.5 | 0.0 | 0.3 | 0.3 |
| OnTime | 0.4 | 1.0 | 0.5 | 0.3 | 0.0 |
| Overall | 0.3 | 0.0 | 0.0 | 0.7 | 0.3 |
| % AS | |||||
| Total | Admin | Library | Maintenance | Support | |
| Better | 0.4 | 0.5 | 0.5 | 0.3 | 0.3 |
| Compare | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| Space | 0.2 | 0.5 | 0.0 | 0.0 | 0.3 |
| Pitch | 0.1 | 0.0 | 0.0 | 0.0 | 0.3 |
| Staff | 0.4 | 0.5 | 0.0 | 0.7 | 0.3 |
A had a similar question about displaying the results compactly without the cross tabs that was resolved here:
https://communities.sas.com/t5/SAS-Programming/Compact-Descriptive-Stats/m-p/864154#M341288
Data.
Starting data in the form of a data step.
Likely make a data set where your current variable name becomes a the value of a variable and the the value into a single variable (maybe proc transpose or a data step equivalent- without existing data hard to tell which will work)
Then tabulate.
If those 0.3 are supposed to be percentages, sort of implied by the "%F" or "%AS" (and just what the heck is an F or AS??????, is that supposed to be a row percentage, table percentage or column percentage.
Correct, it's the % with the value of F (as opposed to not F) by each Unit. Currently I would use an array to make the values F or X (not F). It would be the column percentage here:
proc freq;
tables Sat * Unit;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.