BookmarkSubscribeRSS Feed
SAS93
Quartz | Level 8

I have two variables from a dataset: county and facilityname.

I want to essentially see the county "spread" of each facility, so I can see which facilities are most frequently serviced by each county and vice versa.

 

While I could do a crosstab using proc freq of these two variables, I want to get a more "summarized" output because there are 100-150 different facility names and about 100 counties. 

 

I tried using the FIRST.facilityname by county approach, but that severely limited my overall output/number of observations. 

1 REPLY 1
ballardw
Super User

@SAS93 wrote:

I have two variables from a dataset: county and facilityname.

I want to essentially see the county "spread" of each facility, so I can see which facilities are most frequently serviced by each county and vice versa.

 

While I could do a crosstab using proc freq of these two variables, I want to get a more "summarized" output because there are 100-150 different facility names and about 100 counties. 

 

I tried using the FIRST.facilityname by county approach, but that severely limited my overall output/number of observations. 


I'm afraid that you may need to provide some example of what you mean by "more "summarized" output.

It also sounds like you may not be sure just how many facility names are involved.

 

Something like:

 

Proc summary data=have nway;
   class facility county;
   output out=summary (drop=_type_);
run;

Will generate a data set with just the counts of facilty county combinations in your data set. The variable _freq_ will have the count.

 

You can change the order of the variables on the Class statement to get the output in different order or sort the data.

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 1030 views
  • 0 likes
  • 2 in conversation