Hi,
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
Year Number,
Month Number,
Day Number,
product 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
Please suggest.
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?
Hi,
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,
Kindly suggest.
We are looking for the minimum & Maximum number of times a patient has visited based on the Patient ID.
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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.