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).
Here 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;
Can you provide us with an example of what your desired result looks like? It is much easier to help you then.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.