BookmarkSubscribeRSS Feed
docctong
Fluorite | Level 6

Hello All,

 

I have two different datasets that provide info on claim amount paid by two different sources.  Each  set includes the claimant name, the date of incident, and the amount paid.  So let's say Name1, Date1, and Paid 1 are fields in Set #1, and Name2, Date2, and Paid2 are fields in Set #2.  Each of the two sets includes other fields that are not totally identical.  What I need to do is to find out those claimants who are in both sets of data, i.e., Name1=Name2, and were injured on the same date and so Date1=Date2, and then create a new field named as TotalPaid = Paid1+Paid2.  That is, I need to find out the total amount of paid for each claimant from both sources.  For those claimants exist only in one and not both sets, then TotalPaid=0.  The rationale of using these two conditions to set up the new field is because it is not likely that two individuals who got injured on the same date will have the same name.  How can I do that?  Thanks for helping.  

1 REPLY 1
Reeza
Super User

Post sample data and expected output - not real data because you obviously can't release that, but some data that's similar to what you have, especially if you want code. 

 

Things that are unclear in your current question:

  • Do you want the final dataset to have all people, only people in first dataset, only people in second, only people in both?
  • Are the formats/type the same between the two for merges - they have to be.
  • When I've worked with medical data and we also used a window, not a specific date=date, because a lot of times a wait in an ER can stretch over midnight which means dates for things may be off by at minimum one date. If this isn't a concern feel free to ignore this comment 🙂

Otherwise this is most likely more easy to accomplish in SQL though a data step merge is also possible. 

 

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
  • 1 reply
  • 670 views
  • 0 likes
  • 2 in conversation