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.
@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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.