BookmarkSubscribeRSS Feed
hlg23
Calcite | Level 5

I think I need to complete a few to many merge. For visual purposes, I took a screenshot of the data I want to merge on two datasets, but in reality, the data is all in one Excel file, on two different tabs. Is it possible to do a proc sql procedure to merge and combine datasets on multiple variables? I need to merge the data on "siteid" AND "date" and "rater". I have 28 sites total and each site was observed 5 times (mostly by the same "rater", but sometimes a different one), with individual observations varying by day from as few as 1 to as many as 100+. I eventually want to get an average of the "sec" variables for each site observed. ("sec" is time, in seconds, spent performing observed activity). 

Screenshot (47).pngHere is some code I came up with, but I have not had a chance to run it to see if it would work : 

proc sql; 

create table <want> as

select * from <have>

group by siteid

having date=min(date)

order by siteid, date, rater;

quit;

 

 

1 REPLY 1
PeterClemmensen
Tourmaline | Level 20

Can you provide us with an example of what your desired result looks like? It is much easier to help you then.

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
  • 711 views
  • 0 likes
  • 2 in conversation