<?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 create different values as data set in proc compare in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-different-values-as-data-set-in-proc-compare/m-p/589692#M168702</link>
    <description>&lt;P&gt;Questions arise for your requirement as to are you looking for values of Id in Ex1 that do not appear in Ex2 &lt;STRONG&gt;or&lt;/STRONG&gt; are you looking for observations in order values of ID in Ex1 and Ex2?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Compare matches rows by order (unless you are using BY and there are still concerns) So if you have&lt;/P&gt;
&lt;PRE&gt;data work.ex2 ;
input id $ ;
cards ;
104
101 
;&lt;/PRE&gt;
&lt;P&gt;The 101 do no match unless you sort both sets by that value and even then you may have issues as the gaps in the variables have mismatched values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the concern is the values and not the order / observations then perhaps:&lt;/P&gt;
&lt;PRE&gt;data work.ex1 ;
input id $;
cards ; 
101
102
103
;
data work.ex2 ;
input id $ ;
cards ;
101 
104
;

proc sql;
   create table work.inex1notex2 as
   select id from work.ex1
   except 
   select id from work.ex2
   ;
quit;

proc sql;
   create table work.inex2notex1 as
   select id from work.ex2
   except 
   select id from work.ex1
   ;
quit;&lt;/PRE&gt;</description>
    <pubDate>Wed, 18 Sep 2019 15:06:25 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-09-18T15:06:25Z</dc:date>
    <item>
      <title>how to create different values as data set in proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-different-values-as-data-set-in-proc-compare/m-p/589681#M168696</link>
      <description>&lt;P&gt;data ex1 ;&lt;BR /&gt;input id $;&lt;BR /&gt;cards ; &lt;BR /&gt;101&lt;BR /&gt;102&lt;BR /&gt;103&lt;BR /&gt;;&lt;BR /&gt;data ex2 ;&lt;BR /&gt;input id $ ;&lt;BR /&gt;cards ;&lt;BR /&gt;101 &lt;BR /&gt;104&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc compare data=ex1 compare=ex2&amp;nbsp; out=diff;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wrote proc compare .&lt;/P&gt;
&lt;P&gt;How to create dataset for different values like&lt;/P&gt;
&lt;P&gt;dataset1:&lt;/P&gt;
&lt;P&gt;101&lt;/P&gt;
&lt;P&gt;103&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data set2:&lt;/P&gt;
&lt;P&gt;104&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 14:48:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-different-values-as-data-set-in-proc-compare/m-p/589681#M168696</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2019-09-18T14:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to create different values as data set in proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-different-values-as-data-set-in-proc-compare/m-p/589687#M168699</link>
      <description>&lt;P&gt;Do you want to do this with PROC COMPARE or any tool?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 14:59:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-different-values-as-data-set-in-proc-compare/m-p/589687#M168699</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-09-18T14:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to create different values as data set in proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-different-values-as-data-set-in-proc-compare/m-p/589690#M168701</link>
      <description>Proc compare only&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Sep 2019 15:00:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-different-values-as-data-set-in-proc-compare/m-p/589690#M168701</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2019-09-18T15:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to create different values as data set in proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-different-values-as-data-set-in-proc-compare/m-p/589692#M168702</link>
      <description>&lt;P&gt;Questions arise for your requirement as to are you looking for values of Id in Ex1 that do not appear in Ex2 &lt;STRONG&gt;or&lt;/STRONG&gt; are you looking for observations in order values of ID in Ex1 and Ex2?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Compare matches rows by order (unless you are using BY and there are still concerns) So if you have&lt;/P&gt;
&lt;PRE&gt;data work.ex2 ;
input id $ ;
cards ;
104
101 
;&lt;/PRE&gt;
&lt;P&gt;The 101 do no match unless you sort both sets by that value and even then you may have issues as the gaps in the variables have mismatched values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the concern is the values and not the order / observations then perhaps:&lt;/P&gt;
&lt;PRE&gt;data work.ex1 ;
input id $;
cards ; 
101
102
103
;
data work.ex2 ;
input id $ ;
cards ;
101 
104
;

proc sql;
   create table work.inex1notex2 as
   select id from work.ex1
   except 
   select id from work.ex2
   ;
quit;

proc sql;
   create table work.inex2notex1 as
   select id from work.ex2
   except 
   select id from work.ex1
   ;
quit;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Sep 2019 15:06:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-different-values-as-data-set-in-proc-compare/m-p/589692#M168702</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-18T15:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to create different values as data set in proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-different-values-as-data-set-in-proc-compare/m-p/589693#M168703</link>
      <description>Use only proc compare&lt;BR /&gt;The values in ex2 and don't in ex1&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Sep 2019 15:08:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-different-values-as-data-set-in-proc-compare/m-p/589693#M168703</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2019-09-18T15:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to create different values as data set in proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-different-values-as-data-set-in-proc-compare/m-p/589694#M168704</link>
      <description>&lt;P&gt;PROC COMPARE is NOT the right tool for that type of comparison.&amp;nbsp; It is for comparing values between MATCHING observations.&lt;/P&gt;
&lt;P&gt;Your output is a summary of the NON matching observations.&amp;nbsp; That is observations that are excluded from one set or the other.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 15:09:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-different-values-as-data-set-in-proc-compare/m-p/589694#M168704</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-09-18T15:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to create different values as data set in proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-different-values-as-data-set-in-proc-compare/m-p/589696#M168705</link>
      <description>&lt;P&gt;I think this is what you want..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ex1 ;
input id $;
cards ;
101
102
103
;
data ex2 ;
input id $ ;
cards ;
101
104
;

proc compare base=ex1 comp=ex2 out=dataset1(keep=id) outbase outnoequal noprint;
run;

proc compare base=ex2 comp=ex1 out=dataset2(keep=id) outbase outnoequal noprint;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Sep 2019 15:10:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-different-values-as-data-set-in-proc-compare/m-p/589696#M168705</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-09-18T15:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to create different values as data set in proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-different-values-as-data-set-in-proc-compare/m-p/589843#M168759</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/209685"&gt;@thanikondharish&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Use only proc compare&lt;BR /&gt;The values in ex2 and don't in ex1&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Proc Compare is really more&amp;nbsp;intended for data sets that have the same number of observations in the same order (or the likely large&amp;nbsp;number of mismatched values tells that isn't happening).&lt;/P&gt;
&lt;P&gt;And value that appears after the other data set is exhausted for comparison is not going to do what you expect. The Proc basically stops examining anything after the number of rows common to both are exhausted. If one set has 50 records and the other 25 the procedure stops comparing after 25 rows are compared. So you have no idea about the other records though th summary will tell when the last match occurred and that the two sets have different number of observations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And if the data isn't sorted you may not get the "match" you want. Example: Both data sets have the exact same values but appear in different order:&lt;/P&gt;
&lt;PRE&gt;data work.one;
   do i= 1 to 10;
   output;
   end;
run;
data work.two;
   do i= 10 to 1 by -1;
   output;
   end;
run;

proc compare base=work.two compare=work.one;
run;&lt;/PRE&gt;
&lt;P&gt;No matches.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 21:36:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-different-values-as-data-set-in-proc-compare/m-p/589843#M168759</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-18T21:36:33Z</dc:date>
    </item>
  </channel>
</rss>

