BookmarkSubscribeRSS Feed
santosh_pat69
Quartz | Level 8

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.

 

 

 

3 REPLIES 3
Astounding
PROC Star

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?

santosh_pat69
Quartz | Level 8

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.

 

 

 

Astounding
PROC Star

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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

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
  • 3 replies
  • 1084 views
  • 1 like
  • 2 in conversation