BookmarkSubscribeRSS Feed
reddy19
Calcite | Level 5

I have lab data set with below information:

subject    visit   vst_date      test    results
001    visit1  04FEB2018     abc  y
002    visit2  07FEB2018     abc  y


In the database , i have multiple visits for this subject. Here is the sample data

subject    visit    vst_date      test    results
001    visit1wk1    04FEB2018     xyz  y
001    visit2wk2   07FEB2018     XYZ  y
001    visit1wk3    08FEB2018     xyz  y
002    visit2   09FEB2018     XYZ  y

I need to combine both these files,output should look like this

subject    visit    vst_date      test    results
001    visit1wk1    04FEB2018     xyz  y
001    visit1wk1   04FEB2018     abc  y
001    visit2wk2   07FEB2018     XYZ  y
001    visit1wk3    08FEB2018     xyz  y
002    visit2   09FEB2018     XYZ  y


For few visits, single visit in lab data we have multiple visits in database.
link with ‘Visit1’ and vst_date and where a match in database change lab visit to database visit name. If multiple database ‘Visit1’ and vst_date found with same
visit date, lab visit mapped to the first database combination. For example for visist1,  i need to check against visit1wk1, visit1wk2, visit1wk3 with which
visit date value matches, then i need to replace value of the visit in vendor file with that visit. I can use proc format, but there are 200 different visits need to specify. Is there any other look up method i can use to solve this scenario while joining??

 

Thanks in advance!!

 

1 REPLY 1
tomrvincent
Rhodochrosite | Level 12
You could union the 2 tables together...maybe then pick max(visit) per subject and date if you need both 2/4 records to show visit1wk1..

Why does the 2/7 visit for subj 2 drop off?

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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