<?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: problem of verify function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/problem-of-verify-function/m-p/628997#M185939</link>
    <description>&lt;P&gt;thanks all for the explanations&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Mar 2020 02:04:39 GMT</pubDate>
    <dc:creator>harrylui</dc:creator>
    <dc:date>2020-03-03T02:04:39Z</dc:date>
    <item>
      <title>problem of verify function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-of-verify-function/m-p/628691#M185813</link>
      <description>&lt;P&gt;good day,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using&amp;nbsp;verify function to check similarity of my data. but the result looks odd to me.&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV align="center"&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.CHECKING" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;Obs&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;name&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;lag_name&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;checking&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="l data"&gt;Harry&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="l data"&gt;Harry&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;Harry&lt;/TD&gt;
&lt;TD class="r data"&gt;6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="l data"&gt;Henry&amp;nbsp; &amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;Harry&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;4&lt;/TH&gt;
&lt;TD class="l data"&gt;Ben&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;Henry&amp;nbsp;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;seems blank also count one character&lt;/P&gt;
&lt;P&gt;is the sequence matter here because&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;obs 3 should got 3 match word&amp;nbsp;&lt;/P&gt;
&lt;P&gt;obs 4 should got 2 match word&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can anyone help me on that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;below is my program&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data testing;&lt;BR /&gt;input name $40.;&lt;BR /&gt;infile datalines dlm=',';&lt;BR /&gt;datalines;&lt;BR /&gt;Harry&lt;BR /&gt;Harry&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;BR /&gt;Henry&amp;nbsp; &amp;nbsp; &lt;BR /&gt;Ben&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data testing2;&lt;BR /&gt;set testing;&lt;BR /&gt;lag_name=compress(lag(name));&lt;BR /&gt;name2=compress(name);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data checking;&lt;BR /&gt;set testing2;&lt;BR /&gt;checking=VERIFY(name2,lag_name);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks in advance&lt;/P&gt;
&lt;P&gt;harry&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 08:47:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-of-verify-function/m-p/628691#M185813</guid>
      <dc:creator>harrylui</dc:creator>
      <dc:date>2020-03-02T08:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: problem of verify function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-of-verify-function/m-p/628694#M185814</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/107435"&gt;@harrylui&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the output I get when I run the code using the VERIFY() function:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture d’écran 2020-03-02 à 09.50.39.png" style="width: 200px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36488iD2F1F8043EBC8527/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture d’écran 2020-03-02 à 09.50.39.png" alt="Capture d’écran 2020-03-02 à 09.50.39.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This function returns the position of the first character in the string that is not in any of several other strings, so the results seems good:&lt;/P&gt;
&lt;P&gt;- H compared to a blank in first position&lt;/P&gt;
&lt;P&gt;- Second record -&amp;gt; strings are strictly identical so no position is returned (0)&lt;/P&gt;
&lt;P&gt;- e compared to a in second position&lt;/P&gt;
&lt;P&gt;- B compared to a blank in first position&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on what you're trying to achieve, maybe you could explore the COMPGED() function. This function&amp;nbsp;&lt;SPAN&gt;returns the generalized edit distance between two strings, i.e. the largest the distance is, the less similar the strings are. It is up to you to determine the&amp;nbsp;threshold to determine "acceptable similarity". Zero indicates that strings are&amp;nbsp;strictly identical.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data checking;
set testing2;
checking=compged(name2,lag_name);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Capture d’écran 2020-03-02 à 09.55.06.png" style="width: 205px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36489i29CF9A246D0E8425/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture d’écran 2020-03-02 à 09.55.06.png" alt="Capture d’écran 2020-03-02 à 09.55.06.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Hope this helps,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 08:57:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-of-verify-function/m-p/628694#M185814</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-03-02T08:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: problem of verify function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-of-verify-function/m-p/628695#M185815</link>
      <description>&lt;P&gt;The verify function will check the location where your string1 mismatches string2.&lt;/P&gt;&lt;P&gt;So in your example&lt;/P&gt;&lt;P&gt;Henry and Harry the letter H matches with H, but the 2nd letter e does not match with a. So the verify function returns 2.&lt;/P&gt;&lt;P&gt;For Ben and Henry, the 1st letter itself does not match, so the function returns 1.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 09:02:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-of-verify-function/m-p/628695#M185815</guid>
      <dc:creator>akanshya142</dc:creator>
      <dc:date>2020-03-02T09:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: problem of verify function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-of-verify-function/m-p/628997#M185939</link>
      <description>&lt;P&gt;thanks all for the explanations&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 02:04:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-of-verify-function/m-p/628997#M185939</guid>
      <dc:creator>harrylui</dc:creator>
      <dc:date>2020-03-03T02:04:39Z</dc:date>
    </item>
  </channel>
</rss>

