<?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: Proc compare in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-compare/m-p/702793#M215275</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data data1_dif;
	merge check(where=(base) in=a) data1;
	by keyvars;
	if a;
run;

/*pick the different obs*/
data data2_dif;
	merge check(where=(base) in=a) data2;
	by keyvars;
	if a;
run;

/*compare indirectly*/
proc compare b=data1_dif c=data2_dif  OUT=OUTCOMP LISTALL OUTBASE OUTCOMP OUTDIFF OUTNOEQUAL OUTSTATS=diffstat;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 01 Dec 2020 12:39:40 GMT</pubDate>
    <dc:creator>blueskyxyz</dc:creator>
    <dc:date>2020-12-01T12:39:40Z</dc:date>
    <item>
      <title>Proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-compare/m-p/702594#M215196</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc compare base=HT_ORIG_2017_subset&amp;nbsp; compare=HT_NEW_2017_subset out=check outnoequal outdif outstats=diffstat noprint;

id CIHI_KEY;

var HOMETIME AWAYTIME ;

&amp;nbsp;&amp;nbsp; with HOMETIME AWAYTIME;

&amp;nbsp;&amp;nbsp;

&amp;nbsp;&amp;nbsp;&amp;nbsp;title 'Comparison of Variables in Different Data Sets';

run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get&amp;nbsp; the check dataset with 34 obs – are these 34 obs the only obs that have a different value for the 2 var variables specified in the var statement&amp;nbsp; in the 2 datasets?&lt;/P&gt;&lt;P&gt;And the diffstat has the stats produces for the 2 var variables for the 678 obs in the 2 datasets&amp;nbsp; specified in main and compare&lt;/P&gt;&lt;P&gt;How would I instead produce the same stats for the 34 obs ?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 18:09:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-compare/m-p/702594#M215196</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2020-11-30T18:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: Proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-compare/m-p/702793#M215275</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data data1_dif;
	merge check(where=(base) in=a) data1;
	by keyvars;
	if a;
run;

/*pick the different obs*/
data data2_dif;
	merge check(where=(base) in=a) data2;
	by keyvars;
	if a;
run;

/*compare indirectly*/
proc compare b=data1_dif c=data2_dif  OUT=OUTCOMP LISTALL OUTBASE OUTCOMP OUTDIFF OUTNOEQUAL OUTSTATS=diffstat;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Dec 2020 12:39:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-compare/m-p/702793#M215275</guid>
      <dc:creator>blueskyxyz</dc:creator>
      <dc:date>2020-12-01T12:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-compare/m-p/702825#M215280</link>
      <description>Hello&lt;BR /&gt;&lt;BR /&gt;What is the where base variable?&lt;BR /&gt;Are data 1 and data 2 the 2 datasets that I am comparing&lt;BR /&gt;Is the check dataset the one that I created using the code above?</description>
      <pubDate>Tue, 01 Dec 2020 15:48:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-compare/m-p/702825#M215280</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2020-12-01T15:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-compare/m-p/702931#M215332</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*1. first compare directly*/
proc compare base=data1  compare=data2  OUT=OUTCOMP1 LISTALL OUTBASE OUTCOMP OUTDIFF OUTNOEQUAL OUTSTATS=diffstat;
id CIHI_KEY;
var HOMETIME AWAYTIME ;
with HOMETIME AWAYTIME; /*can drop this line since variable name is same as var statements*/
run;

/*pick the different obs*/
/*keyvars: CIHI_KEY， to distinguish each unique record in your datasets */

data data1_dif;
	merge OUTCOMP1 (where=(base) in=a) data1;
	by keyvars;
	if a;
run;

/*pick the different obs*/
data data2_dif;
	merge OUTCOMP1 (where=(base) in=a) data2;
	by keyvars;
	if a;
run;

/*2. second compare indirectly*/
proc compare b=data1_dif c=data2_dif  OUT=OUTCOMP2 LISTALL OUTBASE OUTCOMP OUTDIFF OUTNOEQUAL OUTSTATS=diffstat;
id CIHI_KEY;
var HOMETIME AWAYTIME ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Yes, it is better if you can upload sample datasets to testthe code&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 23:44:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-compare/m-p/702931#M215332</guid>
      <dc:creator>blueskyxyz</dc:creator>
      <dc:date>2020-12-01T23:44:50Z</dc:date>
    </item>
  </channel>
</rss>

