<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Merge datasets few to many merge in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merge-datasets-few-to-many-merge/m-p/489376#M127771</link>
    <description>&lt;P&gt;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).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot (47).png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22706i9BBD24D782824486/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot (47).png" alt="Screenshot (47).png" /&gt;&lt;/span&gt;Here is some code I came up with, but I have not had a chance to run it to see if it would work :&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&amp;nbsp;&lt;/P&gt;&lt;P&gt;create table &amp;lt;want&amp;gt; as&lt;/P&gt;&lt;P&gt;select * from &amp;lt;have&amp;gt;&lt;/P&gt;&lt;P&gt;group by siteid&lt;/P&gt;&lt;P&gt;having date=min(date)&lt;/P&gt;&lt;P&gt;order by siteid, date, rater;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Aug 2018 19:27:19 GMT</pubDate>
    <dc:creator>hlg23</dc:creator>
    <dc:date>2018-08-23T19:27:19Z</dc:date>
    <item>
      <title>Merge datasets few to many merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-datasets-few-to-many-merge/m-p/489376#M127771</link>
      <description>&lt;P&gt;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).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot (47).png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22706i9BBD24D782824486/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot (47).png" alt="Screenshot (47).png" /&gt;&lt;/span&gt;Here is some code I came up with, but I have not had a chance to run it to see if it would work :&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&amp;nbsp;&lt;/P&gt;&lt;P&gt;create table &amp;lt;want&amp;gt; as&lt;/P&gt;&lt;P&gt;select * from &amp;lt;have&amp;gt;&lt;/P&gt;&lt;P&gt;group by siteid&lt;/P&gt;&lt;P&gt;having date=min(date)&lt;/P&gt;&lt;P&gt;order by siteid, date, rater;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 19:27:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-datasets-few-to-many-merge/m-p/489376#M127771</guid>
      <dc:creator>hlg23</dc:creator>
      <dc:date>2018-08-23T19:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: Merge datasets few to many merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-datasets-few-to-many-merge/m-p/489407#M127785</link>
      <description>&lt;P&gt;Can you provide us with an example of what your desired result looks like? It is much easier to help you then.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 20:54:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-datasets-few-to-many-merge/m-p/489407#M127785</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-08-23T20:54:49Z</dc:date>
    </item>
  </channel>
</rss>

