<?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: How to get duplicate values after merging in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-duplicate-values-after-merging/m-p/825834#M35237</link>
    <description>&lt;P&gt;Really need to provide example input.&lt;/P&gt;
&lt;P&gt;As it is we do not know which data set(s) contain any values for column1 and column2 and how they are associated with Usubjid.&lt;/P&gt;
&lt;P&gt;Merge is quite often not the tool to use more than one of your data sets contain multiple values of a By group. So we need to know if that exists in your data.&lt;/P&gt;</description>
    <pubDate>Thu, 28 Jul 2022 03:39:59 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-07-28T03:39:59Z</dc:date>
    <item>
      <title>How to get duplicate values after merging</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-duplicate-values-after-merging/m-p/825809#M35236</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to merge 3 datasets so I divided them into two separate merges.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;usubjid&amp;nbsp; column1 column2&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;I have tried without in= options as well. But its not giving the output I need. Below is the output I need duplicates to print.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;usubjid&amp;nbsp; column1 column2&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not getting any errors, however its also not giving the output I need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much in advance for your help!&lt;/P&gt;&lt;P&gt;here is my code:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc sort data=data1;
by usubjid;
run;

proc sort data=data2;
by usubjid;
run;

proc sort data=data3;
by usubjid;
run;



data MergeD1; (98=obs)
merge data1(in=a) data2;
by usubjid;
if a ;
run;



data MergeD2; (98 obs)
merge MergeD1(in=a) data3;
by usubjid;
if a;
run;



proc print data=MergeD2;

run;


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 01:28:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-duplicate-values-after-merging/m-p/825809#M35236</guid>
      <dc:creator>stp84</dc:creator>
      <dc:date>2022-07-28T01:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to get duplicate values after merging</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-duplicate-values-after-merging/m-p/825834#M35237</link>
      <description>&lt;P&gt;Really need to provide example input.&lt;/P&gt;
&lt;P&gt;As it is we do not know which data set(s) contain any values for column1 and column2 and how they are associated with Usubjid.&lt;/P&gt;
&lt;P&gt;Merge is quite often not the tool to use more than one of your data sets contain multiple values of a By group. So we need to know if that exists in your data.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 03:39:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-duplicate-values-after-merging/m-p/825834#M35237</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-07-28T03:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to get duplicate values after merging</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-duplicate-values-after-merging/m-p/825904#M35239</link>
      <description>&lt;P&gt;Good day&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You're able to fill the blanks by using the below approach.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;/*Dummy data*/
data have;
	infile datalines missover;
	input Key column1 column2;
	datalines;
1 9 5
2 1 6
3 2 7
3
3
4 5 6
4
4
;
run;

/*Select all complete rows*/
proc sql;
	create table have_complete as
		select
			*
		from have 
			where column1 &amp;lt;&amp;gt; .;
quit;

/*Combine and fill blanks*/
proc sql;
	create table want as
		select
			a.Key
			,coalesce(a.column1,b.column1) as column1
			,coalesce(a.column2,b.column2) as column2
		from have as a
			left join have_complete as b
				on (a.Key=b.Key);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jul 2022 12:31:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-duplicate-values-after-merging/m-p/825904#M35239</guid>
      <dc:creator>Adriaan_Gouws</dc:creator>
      <dc:date>2022-07-28T12:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to get duplicate values after merging</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-duplicate-values-after-merging/m-p/825905#M35240</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards truncover;
input usubjid  column1 column2;
cards;
1            9             5
2            1             6
3            2             7
3                       
3                        
4            5             6
4            
4
;

data want;
 update have(obs=0) have;
 by usubjid;
 output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jul 2022 12:38:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-duplicate-values-after-merging/m-p/825905#M35240</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-07-28T12:38:04Z</dc:date>
    </item>
  </channel>
</rss>

