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-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!

New Learning Events in April

 

Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.

LEARN MORE

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