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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 280 views
  • 0 likes
  • 2 in conversation