BookmarkSubscribeRSS Feed
radhikaa4
Calcite | Level 5

Hello. I am trying to merge two datasets. What I would like to do is full join per subject ID even though date_time from dataset 1 doesn't exisit in dataset 2; 

 

First dataset: 

SubjectIDdate_timevalue1
1231/1/2010 9:5352.1
1231/2/2010 10:3121.2
1231/3/2010 9:3332.3
4562/1/2010 9:5342.2
4562/2/2010 10:31123.4
4562/3/2010 9:3347.2
4562/4/2010 14:2344.4

 

second dataset:

SubjectIDdate_timevalue1value2
1231/1/2010 9:5352.110.2
1231/2/2010 10:3121.242.1
4562/1/2010 9:5342.244.8
4562/4/2010 14:2344.432.2

 

want:

SubjectIDdate_timevalue1value2
1231/1/2010 9:5352.110.2
1231/2/2010 10:3121.242.1
1231/3/2010 9:3332.3 
4562/1/2010 9:5342.244.8
4562/2/2010 10:31123.4 
4562/3/2010 9:3347.2 
4562/4/2010 14:2344.432.2

 

Here's my code so far:

 


proc sql;
select t1.subjectid, t1.date_time, t1.value1, t2.value2
from dataset1 t1
left outer join dataset2 t2
where t2.value2 is null 

 

any help would be greatly appreciated

1 REPLY 1

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 590 views
  • 0 likes
  • 2 in conversation