<?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: Compare two Strings in Hebrew in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787761#M251764</link>
    <description>&lt;P&gt;Can you please provide your data via a text file (attachment) and not just a screen-shot? This would allow us to actually replicate and then resolve what you observe.&lt;/P&gt;
&lt;P&gt;....actually: Provide the SAS table and ideally also the Excel&lt;/P&gt;</description>
    <pubDate>Thu, 30 Dec 2021 12:00:45 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2021-12-30T12:00:45Z</dc:date>
    <item>
      <title>Compare two Strings in Hebrew</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787546#M251657</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have to compare two variables that both of them contain values in Hebrew : Name and SecurityName. I my opinion Name variable is ok. Because when i create the values by myself and run compare function versus Name variable i get result value 0. The problem with SecurityName variable that comes from excel that i attached. Also i attached dataset.&lt;/P&gt;&lt;P&gt;When i use compare function, the result i got is not correct. Maybe the problem that i read file from xlsx file and proc import doesn't support encoding and&amp;nbsp; in some forums i read that you cannot control the encoding of XLSX format file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first and last observations are identical, but the result is not correct.&lt;/P&gt;&lt;P&gt;When i tried to create the same data and values by myself and run the same compare function i got the right result, i.e maybe something in the&amp;nbsp;encoding or in excel files i read.&lt;/P&gt;&lt;P&gt;I&amp;nbsp; read xlsx files using proc import through call execute.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried kcompare also but the same results&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;result = compare(Name, SecurityName);
&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 513px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67029iEC047F3ECFCE1F0E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what i should do?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 18:42:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787546#M251657</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2021-12-30T18:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two Strings in Hebrew</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787564#M251662</link>
      <description>&lt;P&gt;Hi &lt;A class="trigger-hovercard" style="color: #007dc3;" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/42503" target="_blank"&gt;AlexeyS&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;Could you please provide a sample of values and result you get. Also, could you verify that you are running SAS session with UTF-8 encoding?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Dec 2021 23:40:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787564#M251662</guid>
      <dc:creator>LeonidBatkhan</dc:creator>
      <dc:date>2021-12-28T23:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two Strings in Hebrew</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787608#M251683</link>
      <description>Did you try KCOMPARE() function ?</description>
      <pubDate>Wed, 29 Dec 2021 12:38:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787608#M251683</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-12-29T12:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two Strings in Hebrew</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787677#M251721</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The first and last observations are identical, but the result is not correct.&lt;/P&gt;&lt;P&gt;When i tried to create the same data and values by myself and run the same compare function i got the right result, i.e maybe something in the&amp;nbsp;encoding or in excel files i read.&lt;/P&gt;&lt;P&gt;I&amp;nbsp; read xlsx files using proc import through call execute.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried kcompare also but the same results&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;result0 = compare(Name, SecurityName);
result1 = compare(strip(Name), strip(SecurityName), 'ln');
result2 = compare(strip(Name), strip(SecurityName), 'nl');
result3 = compare(strip(Name), strip(SecurityName), 'n');
result4 = compare(strip(Name), strip(SecurityName));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 615px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66993iCB4CC4E44FA79B1B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i run&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc options  option=encoding;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I got : ENCODING=WHEBREW&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what i should do?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 29 Dec 2021 19:14:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787677#M251721</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2021-12-29T19:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two Strings in Hebrew</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787678#M251722</link>
      <description>&lt;P&gt;yes i tried.&lt;/P&gt;&lt;P&gt;I uploaded some data and results when i run the code. Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 29 Dec 2021 19:15:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787678#M251722</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2021-12-29T19:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two Strings in Hebrew</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787680#M251723</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The first and last observations are identical, but the result is not correct.&lt;/P&gt;&lt;P&gt;When i tried to create the same data and values by myself and run the same compare function i got the right result, i.e maybe something in the&amp;nbsp;encoding or in excel files i read.&lt;/P&gt;&lt;P&gt;I&amp;nbsp; read xlsx files using proc import through call execute.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried kcompare also but the same results&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;result0 = compare(Name, SecurityName);
result1 = compare(strip(Name), strip(SecurityName), 'ln');
result2 = compare(strip(Name), strip(SecurityName), 'nl');
result3 = compare(strip(Name), strip(SecurityName), 'n');
result4 = compare(strip(Name), strip(SecurityName));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlexeyS_0-1640805864219.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66994i753E8D72AD6642A9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlexeyS_0-1640805864219.png" alt="AlexeyS_0-1640805864219.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i run&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc options  option=encoding;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I got : ENCODING=WHEBREW&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what i should do?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Dec 2021 19:24:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787680#M251723</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2021-12-29T19:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two Strings in Hebrew</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787761#M251764</link>
      <description>&lt;P&gt;Can you please provide your data via a text file (attachment) and not just a screen-shot? This would allow us to actually replicate and then resolve what you observe.&lt;/P&gt;
&lt;P&gt;....actually: Provide the SAS table and ideally also the Excel&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 12:00:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787761#M251764</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-12-30T12:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two Strings in Hebrew</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787835#M251811</link>
      <description>&lt;P&gt;&lt;EM&gt;Yes of course. Please&amp;nbsp; see original post, i added full information, dataset and excel. Thank you&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 18:43:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787835#M251811</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2021-12-30T18:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two Strings in Hebrew</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787836#M251812</link>
      <description>&lt;P&gt;&lt;EM&gt;Please&amp;nbsp; see original post, i added full information, dataset and excel. Thank you&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 18:44:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787836#M251812</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2021-12-30T18:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two Strings in Hebrew</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787879#M251832</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/42503"&gt;@AlexeyS&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;EM&gt;Please&amp;nbsp; see original post, i added full information, dataset and excel. Thank you&lt;/EM&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/42503"&gt;@AlexeyS&lt;/a&gt;&amp;nbsp;Thanks! That helped.&lt;/P&gt;
&lt;P&gt;Add the following to your code and things will start working:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Securityname=kcompress(Securityname,'00'x);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For some reason your variable SecurityName is padded with hex 00 and though the strings in the two variables are actually always different.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data check;
  set test.test;
  l1=lengthn(name);
  l2=lengthn(Securityname);
  
  h1=put(name,hex72.);
  h2=put(Securityname,hex72.);
run;
proc print data=check;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1640913593517.png" style="width: 1021px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67034iFF302821B0DDFE02/image-dimensions/1021x108?v=v2" width="1021" height="108" role="button" title="Patrick_0-1640913593517.png" alt="Patrick_0-1640913593517.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Excel you've provided is not the source with which you've created the test SAS file. For this reason I couldn't further investigate what might have caused these trailing hex 00 values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname test xlsx '....';
data check;
  set test.test;
  l2=lengthn(Securityname);
  
  h2=put(Securityname,hex72.);
run;
proc print data=check;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1640913938422.png" style="width: 855px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67035i279FA079E13FE5F6/image-dimensions/855x159?v=v2" width="855" height="159" role="button" title="Patrick_0-1640913938422.png" alt="Patrick_0-1640913938422.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 01:25:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787879#M251832</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-12-31T01:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two Strings in Hebrew</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787918#M251835</link>
      <description>&lt;P&gt;First of all Thank you very much.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to ask you a question, Is there any way to identify these problems in variable and which way?&lt;/P&gt;&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 15:30:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787918#M251835</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2021-12-31T15:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two Strings in Hebrew</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787964#M251850</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/42503"&gt;@AlexeyS&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;First of all Thank you very much.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to ask you a question, Is there any way to identify these problems in variable and which way?&lt;/P&gt;
&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You could search for non-printable characters and then list the hex values if found any. Below some sample code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname test '...';
data check;
  set test.test;
  length _row_num 8 _varname $32 _non_print_chars $100 _hex_non_print_chars $200;
  array _cvars {*} _character_;
  do _i=1 to dim(_cvars);
  	_non_print_chars=kcompress(_cvars[_i],,'w');
    _len=klength(_non_print_chars);
	if _len&amp;gt;0 then
      do;
        _fmt=cats('hex',2*_len,'.');
		_hex_non_print_chars=putc(_non_print_chars,_fmt);
		_varname=vname(_cvars[_i]);
        _row_num=_n_;
		output;
	  end;
  end;
  keep _row_num _varname _hex_non_print_chars;
  rename _row_num=row_num _varname=varname _hex_non_print_chars=hex_non_print_chars;
run;
proc print data=check;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 01 Jan 2022 00:12:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-Strings-in-Hebrew/m-p/787964#M251850</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-01-01T00:12:39Z</dc:date>
    </item>
  </channel>
</rss>

