<?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 join two dataset in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/join-two-dataset/m-p/443443#M69341</link>
    <description>&lt;P&gt;Hi guys&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking for code to join four datasets matching columns, the name of my datasets are p1, p2, p2, p3, and p4.&lt;/P&gt;&lt;P&gt;I would like to join them by COW_ID and PR variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks guys&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ibrahim&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Mar 2018 18:12:27 GMT</pubDate>
    <dc:creator>Barkamih</dc:creator>
    <dc:date>2018-03-07T18:12:27Z</dc:date>
    <item>
      <title>join two dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/join-two-dataset/m-p/443443#M69341</link>
      <description>&lt;P&gt;Hi guys&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking for code to join four datasets matching columns, the name of my datasets are p1, p2, p2, p3, and p4.&lt;/P&gt;&lt;P&gt;I would like to join them by COW_ID and PR variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks guys&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ibrahim&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 18:12:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/join-two-dataset/m-p/443443#M69341</guid>
      <dc:creator>Barkamih</dc:creator>
      <dc:date>2018-03-07T18:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: join two dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/join-two-dataset/m-p/443466#M69344</link>
      <description>&lt;P&gt;proc sort data=p1;&lt;/P&gt;
&lt;P&gt;by&amp;nbsp;&lt;SPAN&gt;COW_ID PR;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc sort data=p2;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;by COW_ID PR;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc sort data=p3;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;by COW_ID PR;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc sort data=p4;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;by COW_ID PR;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;data mrgall;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;merge p1(in=a) p2(in=b) p3(in=c) p4 (in=d);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;by&amp;nbsp;COW_ID PR;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if a and b and c and d then output;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;run;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 19:11:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/join-two-dataset/m-p/443466#M69344</guid>
      <dc:creator>saspert</dc:creator>
      <dc:date>2018-03-07T19:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: join two dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/join-two-dataset/m-p/443498#M69345</link>
      <description>&lt;P&gt;Do any of these data sets have duplicate values of combinations of COW_ID and PR?&lt;/P&gt;
&lt;P&gt;This is important as how those are supposed to match up may be an issue when considering one-to-many or many-to-many matching.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best might be to provide a small sample from each of your sets and what the expected result for those samples would look like.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 20:41:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/join-two-dataset/m-p/443498#M69345</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-07T20:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: join two dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/join-two-dataset/m-p/443727#M69348</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;this is a sample of two datasets 
HERD	          COW_ID       CALVING_DATE   CAease    Pr      TEST_DATE      MILK_KG	FAT_KG
60007197	666355946	23/11/2011	1	1	29/4/2014	34.6	1.0553
60007197	666355946	23/11/2011	1	1	12/6/2014	19.8	0.6237
60007197	666355946	23/11/2011	1	1	19/8/2014	30.4	0.988
60007197	666355946	23/11/2011	1	1	27/11/2014	11.4	0.3751
59996534	816229712	16/4/2013	2	1	25/2/2014	22.6	1.5097
59996534	816229712	16/4/2013	2	1	27/3/2014	23.8	1.6065
59996534	816229712	16/4/2013	2	1	22/5/2014	21.4	1.5536
59996534	816229712	16/4/2013	2	1	23/9/2014	14.6	0.9884
60005742	817069792	20/4/2013	3	1	5/3/2014	33.4	1.0588&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;all my data looks like this. So, in thsi case i should have a code to put them in vertical psotions. &lt;BR /&gt;regards &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Mar 2018 12:50:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/join-two-dataset/m-p/443727#M69348</guid>
      <dc:creator>Barkamih</dc:creator>
      <dc:date>2018-03-08T12:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: join two dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/join-two-dataset/m-p/443730#M69349</link>
      <description>&lt;P&gt;my dataset has the same variables, I just want to put them together.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 13:02:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/join-two-dataset/m-p/443730#M69349</guid>
      <dc:creator>Barkamih</dc:creator>
      <dc:date>2018-03-08T13:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: join two dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/join-two-dataset/m-p/443819#M69353</link>
      <description>&lt;P&gt;Combining data sets vertically (appending) can be easily done with&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set data1 data2 data3 data4; /*or what ever the data set names are*/&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want the result in a specific order sort after combining.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have no duplicates of the variables you mentioned in any of the datasets, if each data set is sorted by the variables, then a MERGE would interleave the data but duplicate values of the key variables would result in other variables being replaced by values from other sets depending on the order of the data.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 16:47:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/join-two-dataset/m-p/443819#M69353</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-08T16:47:21Z</dc:date>
    </item>
  </channel>
</rss>

