<?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 Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-COMPARE/m-p/97981#M27612</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="jive-link-thread-small" data-containerid="32" data-containertype="14" data-objectid="33633" data-objecttype="1" href="https://communities.sas.com/thread/33633"&gt;https://communities.sas.com/thread/33633&lt;/A&gt;&lt;SPAN&gt; I am sure this would help. Proc compare compares each column from table 1 to table 2 in a row. For example if there is a rundate in table1 and rundate in table2 need not be same even you started to run the code same time to get table1 and table2. For comparing two tables I am sure this is going to be usefulcode. /* first outer join table1 and table2*/ Proc SQL; Create table table1andtable2outerjoin as Select a.id as id_1, a.name as name_1, b.id as id_2, b.name as name_2 From table1 as a&amp;nbsp;&amp;nbsp; Full Outer Join&amp;nbsp;&amp;nbsp; table2 as b&amp;nbsp;&amp;nbsp; on a.id = b.id and&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a.name=b.name;&amp;nbsp;&amp;nbsp; Quit; /*to see rows only in table2 not in table1 you can add more columns for comparison*/&amp;nbsp;&amp;nbsp; Data tablenew;&amp;nbsp;&amp;nbsp; Source = 'two';&amp;nbsp;&amp;nbsp; Length Source $5;&amp;nbsp;&amp;nbsp; Set table1andtable2outerjoin ;&amp;nbsp;&amp;nbsp; if missing(id_1) and missing(name_1) then output;&amp;nbsp;&amp;nbsp; Format Source $5.;&amp;nbsp;&amp;nbsp; Informat Source $5.;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run; /*to see rows only in table1not in table2 you can add more columns for comparison*/ Data tableold; Source = 'one';&amp;nbsp;&amp;nbsp; Length Source $5;&amp;nbsp;&amp;nbsp; Set table1andtable2outerjoin;&amp;nbsp;&amp;nbsp; if missing(id_2) and missing(name_2)&amp;nbsp; then output;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Format Source $5.;&amp;nbsp;&amp;nbsp; Informat Source $5.;&amp;nbsp;&amp;nbsp; run; /*to see rows side by side*/&amp;nbsp;&amp;nbsp; Data tablenewold;&amp;nbsp;&amp;nbsp; Set tablenew tableold;&amp;nbsp;&amp;nbsp; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Oct 2012 21:28:41 GMT</pubDate>
    <dc:creator>sassharp</dc:creator>
    <dc:date>2012-10-18T21:28:41Z</dc:date>
    <item>
      <title>PROC COMPARE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-COMPARE/m-p/97980#M27611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have a situation ,like i am comparing the pervious database to new database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For exapmple . AE dataset. we collected Ae dataset in 2011 and 2012. I am comparing both datasets.&lt;/P&gt;&lt;P&gt;i need to show the newly added records. difference between old and new. I am using this code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;compare&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;base&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; = ae&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&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;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;compare&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; = aenew&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&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;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; = difs&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&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;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;OUTNOEQUAL&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;LISTEQUALVAR&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;LISTCOMPVAR&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;LISTBASEVAR&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&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;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;MAXPRINT&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;300&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;&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;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;id&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; usubjid;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;in new data(2012) one or more usubjid have extra records. How to display new reocord and how to display the variable having different values &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;Sam&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2012 20:11:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-COMPARE/m-p/97980#M27611</guid>
      <dc:creator>sam369</dc:creator>
      <dc:date>2012-10-17T20:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: PROC COMPARE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-COMPARE/m-p/97981#M27612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="jive-link-thread-small" data-containerid="32" data-containertype="14" data-objectid="33633" data-objecttype="1" href="https://communities.sas.com/thread/33633"&gt;https://communities.sas.com/thread/33633&lt;/A&gt;&lt;SPAN&gt; I am sure this would help. Proc compare compares each column from table 1 to table 2 in a row. For example if there is a rundate in table1 and rundate in table2 need not be same even you started to run the code same time to get table1 and table2. For comparing two tables I am sure this is going to be usefulcode. /* first outer join table1 and table2*/ Proc SQL; Create table table1andtable2outerjoin as Select a.id as id_1, a.name as name_1, b.id as id_2, b.name as name_2 From table1 as a&amp;nbsp;&amp;nbsp; Full Outer Join&amp;nbsp;&amp;nbsp; table2 as b&amp;nbsp;&amp;nbsp; on a.id = b.id and&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a.name=b.name;&amp;nbsp;&amp;nbsp; Quit; /*to see rows only in table2 not in table1 you can add more columns for comparison*/&amp;nbsp;&amp;nbsp; Data tablenew;&amp;nbsp;&amp;nbsp; Source = 'two';&amp;nbsp;&amp;nbsp; Length Source $5;&amp;nbsp;&amp;nbsp; Set table1andtable2outerjoin ;&amp;nbsp;&amp;nbsp; if missing(id_1) and missing(name_1) then output;&amp;nbsp;&amp;nbsp; Format Source $5.;&amp;nbsp;&amp;nbsp; Informat Source $5.;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run; /*to see rows only in table1not in table2 you can add more columns for comparison*/ Data tableold; Source = 'one';&amp;nbsp;&amp;nbsp; Length Source $5;&amp;nbsp;&amp;nbsp; Set table1andtable2outerjoin;&amp;nbsp;&amp;nbsp; if missing(id_2) and missing(name_2)&amp;nbsp; then output;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Format Source $5.;&amp;nbsp;&amp;nbsp; Informat Source $5.;&amp;nbsp;&amp;nbsp; run; /*to see rows side by side*/&amp;nbsp;&amp;nbsp; Data tablenewold;&amp;nbsp;&amp;nbsp; Set tablenew tableold;&amp;nbsp;&amp;nbsp; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2012 21:28:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-COMPARE/m-p/97981#M27612</guid>
      <dc:creator>sassharp</dc:creator>
      <dc:date>2012-10-18T21:28:41Z</dc:date>
    </item>
  </channel>
</rss>

