<?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: Quick question of ID variable in Proc compare in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Quick-question-of-ID-variable-in-Proc-compare/m-p/407715#M12433</link>
    <description>&lt;P&gt;You had me curious, and I couldn't be bothered reading the documentation, so I set up a quick test.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, and you'll get a warning message. Run the following code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, I frequently have questions like this, and I find it a lot faster to just set up a quick test than to try to get an answer from the communities. As your SAS skills grow, give it a try!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* 3 keys are unique */
data Apples;
	input var1 var2 var3 var4 var5;
	cards;
1 3 8 8 14
2 0 7 3 9
3 0 4 7 13
3 4 2 14 2
4 0 10 7 7
4 5 9 14 9
4 10 6 0 11
4 14 5 8 4
5 6 7 6 1
6 12 1 0 5
9 7 3 9 13
10 0 13 11 0
12 3 7 6 11
14 0 1 6 10
14 12 11 11 8
run;

data Oranges;
	input var1 var2 var3 var4 var5;
	cards;
1 3 8 8 14
2 0 7 3 9
3 0 4 7 13
3 4 2 12 12
4 0 10 12 11
4 5 9 8 5
4 10 6 2 6
4 14 5 7 13
5 6 7 11 11
6 12 1 0 5
9 7 3 9 13
10 0 13 11 0
12 3 7 6 11
14 0 1 6 10
14 12 11 11 8
run;

proc compare base=Apples compare=Oranges;
	id var1 var2 var3;
run;

/* 4th record is duplicate key */
data Apples;
	input var1 var2 var3 var4 var5;
	cards;
1 3 8 8 14
2 0 7 3 9
3 0 4 7 13
3 0 4 14 2
4 0 10 7 7
4 5 9 14 9
4 10 6 0 11
4 14 5 8 4
5 6 7 6 1
6 12 1 0 5
9 7 3 9 13
10 0 13 11 0
12 3 7 6 11
14 0 1 6 10
14 12 11 11 8
run;

data Oranges;
	input var1 var2 var3 var4 var5;
	cards;
1 3 8 8 14
2 0 7 3 9
3 0 4 7 13
3 0 4 12 12
4 0 10 12 11
4 5 9 8 5
4 10 6 2 6
4 14 5 7 13
5 6 7 11 11
6 12 1 0 5
9 7 3 9 13
10 0 13 11 0
12 3 7 6 11
14 0 1 6 10
14 12 11 11 8
run;

proc compare base=Apples compare=Oranges;
	id var1 var2 var3;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Oct 2017 16:32:56 GMT</pubDate>
    <dc:creator>TomKari</dc:creator>
    <dc:date>2017-10-26T16:32:56Z</dc:date>
    <item>
      <title>Quick question of ID variable in Proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Quick-question-of-ID-variable-in-Proc-compare/m-p/407701#M12431</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I saw from the documentation the ID variable can be multiple variables (see my example var1-var3). My question is whether the ID variables (var1-var3) has to be unique (which means distinct in base and compare table)? thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;compare&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;base&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; =&amp;nbsp;Table1 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;compare&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; = Table2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;ID&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; var1 var 2 var3;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Jade&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 15:54:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Quick-question-of-ID-variable-in-Proc-compare/m-p/407701#M12431</guid>
      <dc:creator>Jade_SAS</dc:creator>
      <dc:date>2017-10-26T15:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: Quick question of ID variable in Proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Quick-question-of-ID-variable-in-Proc-compare/m-p/407715#M12433</link>
      <description>&lt;P&gt;You had me curious, and I couldn't be bothered reading the documentation, so I set up a quick test.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, and you'll get a warning message. Run the following code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, I frequently have questions like this, and I find it a lot faster to just set up a quick test than to try to get an answer from the communities. As your SAS skills grow, give it a try!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* 3 keys are unique */
data Apples;
	input var1 var2 var3 var4 var5;
	cards;
1 3 8 8 14
2 0 7 3 9
3 0 4 7 13
3 4 2 14 2
4 0 10 7 7
4 5 9 14 9
4 10 6 0 11
4 14 5 8 4
5 6 7 6 1
6 12 1 0 5
9 7 3 9 13
10 0 13 11 0
12 3 7 6 11
14 0 1 6 10
14 12 11 11 8
run;

data Oranges;
	input var1 var2 var3 var4 var5;
	cards;
1 3 8 8 14
2 0 7 3 9
3 0 4 7 13
3 4 2 12 12
4 0 10 12 11
4 5 9 8 5
4 10 6 2 6
4 14 5 7 13
5 6 7 11 11
6 12 1 0 5
9 7 3 9 13
10 0 13 11 0
12 3 7 6 11
14 0 1 6 10
14 12 11 11 8
run;

proc compare base=Apples compare=Oranges;
	id var1 var2 var3;
run;

/* 4th record is duplicate key */
data Apples;
	input var1 var2 var3 var4 var5;
	cards;
1 3 8 8 14
2 0 7 3 9
3 0 4 7 13
3 0 4 14 2
4 0 10 7 7
4 5 9 14 9
4 10 6 0 11
4 14 5 8 4
5 6 7 6 1
6 12 1 0 5
9 7 3 9 13
10 0 13 11 0
12 3 7 6 11
14 0 1 6 10
14 12 11 11 8
run;

data Oranges;
	input var1 var2 var3 var4 var5;
	cards;
1 3 8 8 14
2 0 7 3 9
3 0 4 7 13
3 0 4 12 12
4 0 10 12 11
4 5 9 8 5
4 10 6 2 6
4 14 5 7 13
5 6 7 11 11
6 12 1 0 5
9 7 3 9 13
10 0 13 11 0
12 3 7 6 11
14 0 1 6 10
14 12 11 11 8
run;

proc compare base=Apples compare=Oranges;
	id var1 var2 var3;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 16:32:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Quick-question-of-ID-variable-in-Proc-compare/m-p/407715#M12433</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2017-10-26T16:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: Quick question of ID variable in Proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Quick-question-of-ID-variable-in-Proc-compare/m-p/407757#M12434</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15142"&gt;@TomKari&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 17:59:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Quick-question-of-ID-variable-in-Proc-compare/m-p/407757#M12434</guid>
      <dc:creator>Jade_SAS</dc:creator>
      <dc:date>2017-10-26T17:59:08Z</dc:date>
    </item>
  </channel>
</rss>

