08-30-2016 06:22 PM
I am looking to create a report which has the Maximum/Minimum of Unique-ids a Patient visited had on any day within 2015-16.
My table looks like this.
Datatypes:--- ID Char
First visit date Timestamp
Product Year Month Day Count(ID) as ID
216ABCE 2015 7 3 1
ASSDE 2015 9 1
uJKILEY 2016 29 7
216ABCE 2015 9 13 3
ASSDE 2015 9 9 1 1
uJKILEY 2016 9 20 709
08-30-2016 06:56 PM
Suggestions to get started.
First, combine the month, day, and year:
sasdate = mdy(month, day, year);
That will make the coding easier to read.
Second, add PATIENT to your data set. It's really not possible to perform calculations based on PATIENT when it is not even part of your data.
Third, why would you replace ID with COUNT(ID)? Wouldn't that make the report confusing?
09-01-2016 03:12 PM
Thank you for your quick reply,
I have used the count(ID) as i need to get the max and min of the number of times a patient has visited the hospital.
The data type of ID is char,
We are looking for the minimum & Maximum number of times a patient has visited based on the Patient ID.
09-01-2016 03:16 PM
As you probably guessed, since ID is character you would not store a count in ID. If you plan on programming using SQL, you could use something like:
count(ID) as n_hospital_visits
I don't see hospital in the data either, though. You may need to update your description of the data.