BookmarkSubscribeRSS Feed
alotaibifm
Calcite | Level 5

Hi Everyone, 

 

I am working on a medical records data and I'm getting three separate files (Demographic file, Medication file, Diagnosis file). In each file, there is a specific date for a specific procedure. For instance, in the demographic file has a date for the time the patient visits the Emergency room, and in the diagnosis file there are dates for each diagnosis, and finally, the medication file has dates for each medication. 

 

I want to merge all the three file in ONE dataset based on the date in the demographic file. So, I want to see if there is MATCHED date between the three files and merge them based on that. Is it possible? I have a full format date like this (28MAY2016). 

 

Thanks, 

5 REPLIES 5
Astounding
PROC Star

MERGE works as long as you want exact matches only.

 

If  diagnosis date might be the day after the ER date, (or if a medication date might be a few days after the ER date), MERGE would not be the best tool for the job.  

alotaibifm
Calcite | Level 5

Sometimes the record shows exact dates and some other observations have one or two days different. Any suggestions? 

ballardw
Super User

Can you provide any example data in the form of a data step?

Don't post any sensitive data but the data should be similar to yours, such as replacing patientid information with values like 1111 2222 3333 or such.

 

 

alotaibifm
Calcite | Level 5

 

I have uploaded the sample of the data elements on a PDF. I just created a hypothetical number. I want to merge the demographic file with the medical condition file when (Visit_Date) in the demographic file matching with (BEG_EFFECTIVE_DT_TM) in the medical condition file. 

 

Thanks, 

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1137 views
  • 0 likes
  • 4 in conversation