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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5 replies
  • 914 views
  • 0 likes
  • 4 in conversation