<?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 Re: Merging datasets with unequal observations in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Merging-datasets-with-unequal-observations/m-p/460391#M70309</link>
    <description>&lt;P&gt;Fantastic, it works! Thanks a lot for your reply!&lt;/P&gt;</description>
    <pubDate>Mon, 07 May 2018 10:51:34 GMT</pubDate>
    <dc:creator>Marjolein</dc:creator>
    <dc:date>2018-05-07T10:51:34Z</dc:date>
    <item>
      <title>Merging datasets with unequal observations</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merging-datasets-with-unequal-observations/m-p/460357#M70307</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm struggling combining datasets with unequal observations in SAS. I have dataset A with 8000 observations (containing variables X and Y), and dataset B (containing variable Z)&amp;nbsp;with 9000 observations. Both datasets have a common identifier.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to have dataset A, and pull variable Z from dataset B to dataset A (so the dataset will have 8000 obs, with the added variable from dataset B). Does anyone know how to do so?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 07 May 2018 07:22:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merging-datasets-with-unequal-observations/m-p/460357#M70307</guid>
      <dc:creator>Marjolein</dc:creator>
      <dc:date>2018-05-07T07:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Merging datasets with unequal observations</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merging-datasets-with-unequal-observations/m-p/460363#M70308</link>
      <description>&lt;P&gt;To merge data sets so that only common id values in both data sets are included in the output you can use the in= data set option&amp;nbsp;which has the value of 1 if the data set contributes to the current observation or 0 if it doesn't. Here is an example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dataa;
	length id $1 x $5 y $6;
	infile datalines dlm=",";
	input id x y;
	datalines;
A,CAT,BLUE
B,DOG,GREEN
C,BIRD,RED
D,FISH,YELLOW
;
run;

data datab;
	length id $1 z $7;
	infile datalines dlm=",";
	input id z;
	datalines;
A,USA
B,UK
C,GERMANY
D,CANADA
E,SPAIN
F,ITALY
;
run;

data datac;
	merge dataa(in=a) datab(in=b);
	by id;
	if a and b;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 May 2018 08:05:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merging-datasets-with-unequal-observations/m-p/460363#M70308</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2018-05-07T08:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: Merging datasets with unequal observations</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merging-datasets-with-unequal-observations/m-p/460391#M70309</link>
      <description>&lt;P&gt;Fantastic, it works! Thanks a lot for your reply!&lt;/P&gt;</description>
      <pubDate>Mon, 07 May 2018 10:51:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merging-datasets-with-unequal-observations/m-p/460391#M70309</guid>
      <dc:creator>Marjolein</dc:creator>
      <dc:date>2018-05-07T10:51:34Z</dc:date>
    </item>
  </channel>
</rss>

