<?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: Hash object and find similiarty in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Hash-object-and-find-similiarty/m-p/264486#M310256</link>
    <description>&lt;P&gt;Thank you very much for your answer.&lt;/P&gt;
&lt;P&gt;I wanted to do with has object for the speed and efficiency.&lt;/P&gt;
&lt;P&gt;I understand that you said &amp;nbsp;there hash object &amp;nbsp;Where equality occurs of this method.&lt;/P&gt;
&lt;P&gt;Thank you for your explanation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code you have written comparing the next record.I did an insert for code and&amp;nbsp;results occurred exactly what I expected.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; if first.sid &lt;EM&gt;&lt;STRONG&gt;and is_same='base'&lt;/STRONG&gt;&lt;/EM&gt; then do;&lt;/P&gt;
&lt;P&gt;In the final code below ;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
 set have;
 by sid;
 if first.sid and is_same='base' then do;
  _ssn_1=ssn_1; _ssn_2=ssn_2; _ssn_3=ssn_3; _fname=fname; _mname=mname;
 end;
 else do;
  is_same=cats(ifc(ssn_1=_ssn_1,'Y','N'),
               ifc(ssn_2=_ssn_2 ,'Y','N'),
               ifc(ssn_3=_ssn_3 ,'Y','N'),
               ifc(fname=_fname ,'Y','N'),
               ifc(mname=_mname,'Y','N'));
 end;
 retain _ssn_1 _ssn_2 _ssn_3 _fname _mname;
 drop _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;best regards..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Apr 2016 07:12:02 GMT</pubDate>
    <dc:creator>erdem_ustun</dc:creator>
    <dc:date>2016-04-18T07:12:02Z</dc:date>
    <item>
      <title>Hash object and find similiarty</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-object-and-find-similiarty/m-p/264354#M310254</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have a data as it below&amp;nbsp;and &amp;nbsp;lots of records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;id,sid,ssn_1,ssn_2,ssn_3,fname,mname,&lt;SPAN&gt;is_same&lt;/SPAN&gt;&lt;BR /&gt;1,1,101,245,655,aa,bb,base&lt;BR /&gt;2,1,101,202,655,AAA,bb,&lt;BR /&gt;3,1,103,200,657,CCC,bb,&lt;BR /&gt;4,1,103,245,655,aa,DDE,&lt;BR /&gt;5,1,104,245,699,BBB,MKE,&lt;BR /&gt;6,2,303,490,1310,Maa,bb,base&lt;BR /&gt;7,2,303,404,1310,FFF,bb,&lt;BR /&gt;8,2,309,400,1314,KKK,bb,&lt;BR /&gt;9,2,309,490,1310,Maa,DDE,&lt;BR /&gt;10,3,312,735,2097,BBB,TME,base&lt;BR /&gt;11,3,303,735,1965,aa,bb,&lt;BR /&gt;12,4,1212,808,2620,LARE,KEAN,base&lt;BR /&gt;13,4,1236,800,2628,CCC,bb,&lt;BR /&gt;14,4,1236,808,2620,LARE,KAANE,&lt;BR /&gt;15,4,1212,980,2796,BBB,KEAN,&lt;BR /&gt;..,..,..,..,..,..,..,..&lt;/P&gt;
&lt;P&gt;I want to do is to compare with &lt;STRONG&gt;hash object&lt;/STRONG&gt; &amp;nbsp;the records &amp;nbsp;and fields by&amp;nbsp;&lt;STRONG&gt;same sid&lt;/STRONG&gt; .İf it is same all fields .&lt;/P&gt;
&lt;P&gt;All variables are the same ' put YYYYY' to &lt;SPAN&gt;is_same&lt;/SPAN&gt;.if&amp;nbsp;only first (ssn_1)&amp;nbsp;and third(ssn_3)&amp;nbsp;fields are the same&amp;nbsp;&lt;SPAN&gt;put YNYNN' to is_same.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;is it possible to use nested hash object?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;The reference point for each sid where result='base'&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for example first loop is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;reference_1: id=1 and sid=&lt;SPAN&gt;1 and ssn_1=101 and ssn_2=245 and ssn_3=655 and fname=aa and sname=bb&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;compare_1: &amp;nbsp;id=2 and sid=&lt;SPAN&gt;1 and ssn_1=101 and ssn_2=202 and ssn_3=655 and fname=AAA and sname=bb&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;result_1 :for ssn_1 is same and dor ssn_2 is not the same and for ssn_3 is same and for fname &amp;nbsp;is&amp;nbsp;not the same and for&amp;nbsp;sname is same then result=YNYNY&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;....loop&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;if&amp;nbsp;sid changed, the reference point will change.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;How do I resolve this situation.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;I want to result &amp;nbsp;for sid=1&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;id,sid,ssn_1,ssn_2,ssn_3,fname,mname,is_same&lt;BR /&gt;1,1,101,245,655,aa,bb,base&lt;BR /&gt;2,1,101,202,655,AAA,bb,YNYNY&lt;BR /&gt;3,1,103,200,657,CCC,bb,NNNNN&lt;BR /&gt;4,1,103,245,655,aa,DDE,NYYYN&lt;BR /&gt;5,1,104,245,699,BBB,MKE,NYNNN&lt;BR /&gt;..,..,..,..,..,..,..,..&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/2824i7AA54E3F6AEE98C4/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="result.jpg" title="result.jpg" /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;is it possible to solve to nested and conditional hash object for in order to be fast and effective.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;best regards..&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Apr 2016 14:14:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-object-and-find-similiarty/m-p/264354#M310254</guid>
      <dc:creator>erdem_ustun</dc:creator>
      <dc:date>2016-04-16T14:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: Hash object and find similiarty</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-object-and-find-similiarty/m-p/264386#M310255</link>
      <description>Hash Object has a method EQUAL() to judge whether two Hash Object is equal .But the way I looked, you don't need this method .
&lt;PRE&gt;

data have;
infile cards truncover dlm=',';
input id sid ssn_1 ssn_2 ssn_3 fname $ mname $ is_same $;
cards;
1,1,101,245,655,aa,bb,base
2,1,101,202,655,AAA,bb,
3,1,103,200,657,CCC,bb,
4,1,103,245,655,aa,DDE,
5,1,104,245,699,BBB,MKE,
6,2,303,490,1310,Maa,bb,base
7,2,303,404,1310,FFF,bb,
8,2,309,400,1314,KKK,bb,
9,2,309,490,1310,Maa,DDE,
10,3,312,735,2097,BBB,TME,base
11,3,303,735,1965,aa,bb,
12,4,1212,808,2620,LARE,KEAN,base
13,4,1236,800,2628,CCC,bb,
14,4,1236,808,2620,LARE,KAANE,
15,4,1212,980,2796,BBB,KEAN,
;
run;
data want;
 set have;
 by sid;
 if first.sid then do;
  _ssn_1=ssn_1; _ssn_2=ssn_2; _ssn_3=ssn_3; _fname=fname; _mname=mname;
 end;
 else do;
  is_same=cats(ifc(ssn_1=_ssn_1,'Y','N'),
               ifc(ssn_2=_ssn_2 ,'Y','N'),
               ifc(ssn_3=_ssn_3 ,'Y','N'),
               ifc(fname=_fname ,'Y','N'),
               ifc(mname=_mname,'Y','N'));
 end;
 retain _ssn_1 _ssn_2 _ssn_3 _fname _mname;
 drop _:;
run;

&lt;/PRE&gt;</description>
      <pubDate>Sun, 17 Apr 2016 02:41:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-object-and-find-similiarty/m-p/264386#M310255</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-04-17T02:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: Hash object and find similiarty</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-object-and-find-similiarty/m-p/264486#M310256</link>
      <description>&lt;P&gt;Thank you very much for your answer.&lt;/P&gt;
&lt;P&gt;I wanted to do with has object for the speed and efficiency.&lt;/P&gt;
&lt;P&gt;I understand that you said &amp;nbsp;there hash object &amp;nbsp;Where equality occurs of this method.&lt;/P&gt;
&lt;P&gt;Thank you for your explanation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code you have written comparing the next record.I did an insert for code and&amp;nbsp;results occurred exactly what I expected.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; if first.sid &lt;EM&gt;&lt;STRONG&gt;and is_same='base'&lt;/STRONG&gt;&lt;/EM&gt; then do;&lt;/P&gt;
&lt;P&gt;In the final code below ;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
 set have;
 by sid;
 if first.sid and is_same='base' then do;
  _ssn_1=ssn_1; _ssn_2=ssn_2; _ssn_3=ssn_3; _fname=fname; _mname=mname;
 end;
 else do;
  is_same=cats(ifc(ssn_1=_ssn_1,'Y','N'),
               ifc(ssn_2=_ssn_2 ,'Y','N'),
               ifc(ssn_3=_ssn_3 ,'Y','N'),
               ifc(fname=_fname ,'Y','N'),
               ifc(mname=_mname,'Y','N'));
 end;
 retain _ssn_1 _ssn_2 _ssn_3 _fname _mname;
 drop _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;best regards..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 07:12:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-object-and-find-similiarty/m-p/264486#M310256</guid>
      <dc:creator>erdem_ustun</dc:creator>
      <dc:date>2016-04-18T07:12:02Z</dc:date>
    </item>
  </channel>
</rss>

