BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
shellp55
Quartz | Level 8

Hi

I'm not even sure if this is the right group or even a SAS procedure so I apologize if I'm wrong on either account.  I am using SAS 9.3.

I have a table of hospital data that includes admit date, discharge date and total length of stay in days.  I've been asked to identify number of patients per day or week for a specific doctor service group (family practice).  So if a patient was in hospital from April 1 to April 5, 2012 and I'm showing per day, then this patient would be counted on Sunday, Monday, Tuesday, Wednesday and Thursday.  Any thoughts on how to do this for the entire database?

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

It's an occupancy rate calculations, similar to counting a hotel night.

One way is to expand your data set so you have a record for every day and then run a proc freq by date and facility. But it is data intensive, the data set can get very big, very fast.

data want;

set have;

do date=admit_date to discharge_date;

output;

end;

run;

proc freq data=want;

table have;

run;

View solution in original post

5 REPLIES 5
bnarang
Calcite | Level 5

Hi.

Can you post some sample data to understand how your data looks like?

Reeza
Super User

It's an occupancy rate calculations, similar to counting a hotel night.

One way is to expand your data set so you have a record for every day and then run a proc freq by date and facility. But it is data intensive, the data set can get very big, very fast.

data want;

set have;

do date=admit_date to discharge_date;

output;

end;

run;

proc freq data=want;

table have;

run;

shellp55
Quartz | Level 8

Hi

Thanks so much, Reeza, that worked as I wanted it to.  Another question for you:  right now I'm able to indicate number of patients per day what if I want average number of patients per day, do I divide each day volumes by 52 (if for the full year)?

Thanks.

Reeza
Super User

If you want the average number of patients per day run a proc means on the output from proc freq, to get the average number per day.

You can always manually add it up and divide but I prefer using procedures.

shellp55
Quartz | Level 8

Thanks Reeza!!!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 5 replies
  • 1968 views
  • 3 likes
  • 3 in conversation