## Count Hospital Visit Per Day Patient is in Hospital

Solved
Regular Contributor
Posts: 177

# Count Hospital Visit Per Day Patient is in Hospital

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.

Accepted Solutions
Solution
‎01-01-2013 11:50 PM
Super User
Posts: 23,754

## Re: Count Hospital Visit Per Day Patient is in Hospital

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;

output;

end;

run;

proc freq data=want;

table have;

run;

All Replies
Frequent Contributor
Posts: 86

## Re: Count Hospital Visit Per Day Patient is in Hospital

Hi.

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

Solution
‎01-01-2013 11:50 PM
Super User
Posts: 23,754

## Re: Count Hospital Visit Per Day Patient is in Hospital

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;

output;

end;

run;

proc freq data=want;

table have;

run;

Regular Contributor
Posts: 177

## Re: Count Hospital Visit Per Day Patient is in Hospital

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.

Super User
Posts: 23,754

## Re: Count Hospital Visit Per Day Patient is in Hospital

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.

Regular Contributor
Posts: 177

## Re: Count Hospital Visit Per Day Patient is in Hospital

Thanks Reeza!!!

🔒 This topic is solved and locked.

Discussion stats
• 5 replies
• 863 views
• 3 likes
• 3 in conversation