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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1 reply
  • 619 views
  • 0 likes
  • 2 in conversation