Is there a way to have a variable in a proc freq table be sorted according to it's value in a different variable?
For example, consider the following data:
| County_Name | Value | County_Code |
| A | 1 | 1 |
| B | 2 | 2 |
| A | 3 | 1 |
| A | 4 | 1 |
| B | 4 | 2 |
| C | 6 | 5 |
| D | 7 | 6 |
| E | 9 | 3 |
| F | 7 | 4 |
| G | 3 | 7 |
And I want to create a proc freq table to find the frequency with which each county appeared in the list. However, in the subsequent proc freq table, I want them to be ordered according to their corresponded County_Code, instead of alphabetically. Is this possible in SAS?
How about:
proc freq ;
tables county_code*county_name / list ;
run;
This works!
Dive into keynotes, announcements and breakthroughs on demand.
Explore Now →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.