Hello everyone,
please i have to following dataset. The THCIC_ID variable is the unique ID of each hospital in PROVIDER_NAME variable column. Each observation per hospital is the inidividual patient that was admitted in that hospital. e.g austin state hospital, the first hospital, have 8 admissions. I am asked to provide the mean number of admissions across all hospitals. do i have to create a count ? i dont know how to go about it. There are 361 hospitals and over 9000 observations in the dataset.
Thank you
data set
proc freq data=week6.thcics;
tables provider_name/out=counts noprint;
run;
proc means data=counts;
var count;
run;
PROC FREQ will determine the actual number of admissions per hospital.
To get the mean number of admissions, you would run PROC MEANS on the output of PROC FREQ.
Thank you. Can you please show me the syntax?
is it something like
PROC FREQ DATA = WEEK6.THCICS;
TABLES PROVIDER_NAME;
OUTPUT OUT = MEANS MIN MAX;
RUN;
?
proc freq data=week6.thcics;
tables provider_name/out=counts noprint;
run;
proc means data=counts;
var count;
run;
It worked, thank you
You ca run two nested SQL SELECTs.
proc sql;
select mean (count)
from (select hosp_id, count(*) as count from have group by hosp_id);
quit,;
In the future, please supply data in usable form, in a data step with datalines, not as pictures, so we have something to test against.
Thanks, i do not know how to go about it. t hats why i dont have a data step, i dont know about proc sql yet, can you please explain to me:?
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!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.