<?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: Automating the comparison on fileds in same dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Automating-the-comparison-on-fileds-in-same-dataset/m-p/247275#M46334</link>
    <description>&lt;P&gt;Thanks for the quick reply. Given this information, I would recommend that you run the suggested code. This will give you the comparisons for numeric variables. Then, to accomplish the same for the character variables, you simply add &lt;FONT face="courier new,courier"&gt;var _character_;&lt;/FONT&gt; to the first PROC TRANSPOSE step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=have out=trans;
var _character_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: This assumes that you are not looking for character variables containing "numeric" values which are equal to the values of one of the numeric variables.&lt;/P&gt;</description>
    <pubDate>Mon, 01 Feb 2016 18:47:48 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2016-02-01T18:47:48Z</dc:date>
    <item>
      <title>Automating the comparison on fileds in same dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-the-comparison-on-fileds-in-same-dataset/m-p/247257#M46323</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I have a dataset&lt;/P&gt;
&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="320"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 48pt;" span="5" width="64" /&gt; &lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt; width: 48pt;" height="20" width="64"&gt;A&lt;/TD&gt;
&lt;TD style="width: 48pt;" width="64"&gt;B&lt;/TD&gt;
&lt;TD style="width: 48pt;" width="64"&gt;C&lt;/TD&gt;
&lt;TD style="width: 48pt;" width="64"&gt;D&lt;/TD&gt;
&lt;TD style="width: 48pt;" width="64"&gt;E&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" align="right" height="20"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;2&lt;/TD&gt;
&lt;TD align="right"&gt;3&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" align="right" height="20"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;2&lt;/TD&gt;
&lt;TD align="right"&gt;3&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" align="right" height="20"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;2&lt;/TD&gt;
&lt;TD align="right"&gt;3&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" align="right" height="20"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;2&lt;/TD&gt;
&lt;TD align="right"&gt;3&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" align="right" height="20"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;2&lt;/TD&gt;
&lt;TD align="right"&gt;3&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have to run a code in such a way that it should give me the list of fields that are 100%matched in one output&lt;/P&gt;
&lt;P&gt;ex:&lt;/P&gt;
&lt;P&gt;A,D&lt;/P&gt;
&lt;P&gt;B,E are same&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is any way I can do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 17:46:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-the-comparison-on-fileds-in-same-dataset/m-p/247257#M46323</guid>
      <dc:creator>siddharthpeesary</dc:creator>
      <dc:date>2016-02-01T17:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Automating the comparison on fileds in same dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-the-comparison-on-fileds-in-same-dataset/m-p/247269#M46331</link>
      <description>&lt;P&gt;I think, there is a variety of possible approaches. For your sample data the following simple approach works:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input A B C D E;
cards;
1 2 3 1 2
1 2 3 1 2
1 2 3 1 2
1 2 3 1 2
1 2 3 1 2
;

proc transpose data=have out=trans;
run;

proc sort data=trans nouniquekey;
by col:;
run;

proc transpose data=trans prefix=var out=want(keep=var:);
by col:;
var _name_;
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Does your real dataset contain character variables? How many observations and variables does it have?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 18:35:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-the-comparison-on-fileds-in-same-dataset/m-p/247269#M46331</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-02-01T18:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: Automating the comparison on fileds in same dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-the-comparison-on-fileds-in-same-dataset/m-p/247271#M46332</link>
      <description>yeah I also have character variables&lt;BR /&gt;FIELDS= 100+&lt;BR /&gt;RECORDS=1000-2000</description>
      <pubDate>Mon, 01 Feb 2016 18:35:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-the-comparison-on-fileds-in-same-dataset/m-p/247271#M46332</guid>
      <dc:creator>siddharthpeesary</dc:creator>
      <dc:date>2016-02-01T18:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Automating the comparison on fileds in same dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-the-comparison-on-fileds-in-same-dataset/m-p/247275#M46334</link>
      <description>&lt;P&gt;Thanks for the quick reply. Given this information, I would recommend that you run the suggested code. This will give you the comparisons for numeric variables. Then, to accomplish the same for the character variables, you simply add &lt;FONT face="courier new,courier"&gt;var _character_;&lt;/FONT&gt; to the first PROC TRANSPOSE step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=have out=trans;
var _character_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: This assumes that you are not looking for character variables containing "numeric" values which are equal to the values of one of the numeric variables.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 18:47:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-the-comparison-on-fileds-in-same-dataset/m-p/247275#M46334</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-02-01T18:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: Automating the comparison on fileds in same dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-the-comparison-on-fileds-in-same-dataset/m-p/247277#M46335</link>
      <description>Thank you so much ...It worked &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Mon, 01 Feb 2016 18:48:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-the-comparison-on-fileds-in-same-dataset/m-p/247277#M46335</guid>
      <dc:creator>siddharthpeesary</dc:creator>
      <dc:date>2016-02-01T18:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Automating the comparison on fileds in same dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-the-comparison-on-fileds-in-same-dataset/m-p/247366#M46373</link>
      <description>&lt;P&gt;That would be very easy if you switch into IML code .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input A B C D E;
cards;
1 2 3 1 2
1 2 3 1 2
1 2 3 1 2
1 2 3 1 2
1 2 3 1 2
;
run;
proc iml;
use have;
read all var _ALL_ into x[c=vnames];
close;
do i=1 to ncol(x);
 match=vnames[i];
 found=0;
 do j=i+1 to ncol(x);
  if all(x[,i]=x[,j]) then do;match=catx(' ',match,vnames[j]);found=1;end;
 end;
 if found then print match;
end;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Feb 2016 03:22:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-the-comparison-on-fileds-in-same-dataset/m-p/247366#M46373</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-02-02T03:22:44Z</dc:date>
    </item>
  </channel>
</rss>

