BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ligbag4
Fluorite | Level 6

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_NameValueCounty_Code
A11
B22
A31
A41
B42
C65
D76
E93
F74
G37

 

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

How about:

proc freq ;
tables county_code*county_name / list ;
run;

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

How about:

proc freq ;
tables county_code*county_name / list ;
run;

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore 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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 304 views
  • 0 likes
  • 2 in conversation