BookmarkSubscribeRSS Feed
shellp55
Quartz | Level 8

Hello

I have a data set of patient data with an original and unique ID number per visit.  Occasionally the data is corrected so correction files are produced.   THese corrections could include visits not previously submitted and the corrections may only be for one data element.  What I would like to have happen is that any new abstracts will be added to the original data set from corrections and any data elements from corrections be updated in submissions.

The original file is "sub" and the corrected file is "corr".  Sub has 1506 records and corr has 13 but when I used update the subsequent dataset was 1065 so it didn't work as planned.  The code I used was:

data import_results;

update work.sub work.corr;

by Unique_Key;

run;

What function should I be using to get this to work as I'd like?  Thanks very much.

3 REPLIES 3
art297
Opal | Level 21

Were both of your files sorted by Unique_Key ?  It they were, seeing your log would be needed to see what may have happened.

If they weren't, sort them, then retry your code and let us know if your problem was solved.

Tom
Super User Tom
Super User

You need to include the visit variable in the BY statement.

UPDATE statement will collapse to one observation per BY group.

shellp55
Quartz | Level 8

Hi

I don't know what went wrong with the original but when I sorted them both by Unique_Key and then ran the update, I got 1506 records like I expected.  Thank you both for your replies!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Health and Life Sciences Learning

 

Need courses to help you with SAS Life Sciences Analytics Framework, SAS Health Cohort Builder, or other topics? Check out the Health and Life Sciences learning path for all of the offerings.

LEARN MORE

Discussion stats
  • 3 replies
  • 1329 views
  • 0 likes
  • 3 in conversation