<?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: Flag records having a specific word even with alteration in spelling by one character in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Flag-records-having-a-specific-word-even-with-alteration-in/m-p/278286#M55977</link>
    <description>&lt;P&gt;You need to replace value1 and value2 variable references with the names of your actual variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's not a good idea to run code you don't understand, so I'd start by trying to understand the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Review the code&amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;and highlight the sections you don't understand and someone can help clarify. One good way to do this is to comment the code. Add comments for every proc/data step and even sections of them to highlight what they're doing. If you ever need to use this code again you'll probably be happy you did this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Quick comments regarding&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp﻿&lt;/a&gt;'s code, it's what's called a self join - you're joining each record in your dataset to every other record on the condition in the where clause (WHERE).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=* is the SOUNDS LIKE operator, or SOUNDEX&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/68089/HTML/default/viewer.htm#p0eaz2e63dlj17n1i5z17z3h84vp.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/68089/HTML/default/viewer.htm#p0eaz2e63dlj17n1i5z17z3h84vp.htm&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 17 Jun 2016 18:56:21 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-06-17T18:56:21Z</dc:date>
    <item>
      <title>Flag records having a specific word even with alteration in spelling by one character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flag-records-having-a-specific-word-even-with-alteration-in/m-p/278279#M55974</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I am trying to identify records having a specific word as part of the record. There may be spelling error with alteration in 1-2 characters. A sample dataset is attached for your kind cosnideration. I am trying to flag records having the word "DUODENUM" as well as "DUODENAL" and "DUODENOL" without hard coding.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not sure whether spedic function or soundex function will be of help. To begin with,&amp;nbsp;&lt;SPAN&gt;I used spedis function but I realized that it taking into consideration of the whole statement and the word itself. So I don't know how to apply the matching crieria for alteration in 1-2 characters in the word itself. Sas code used:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test1;
set test;
if find(report, 'DUODENUM')  then value1=spedis(report, 'DUODENUM');
if value1 ne .;
run;

proc sort data =test1(obs=1) out =test2 ; by value1 ;run;


proc sql;
create table test3 as 
select id,report,  (select value1 from test2) as value1, spedis(report, 'DUODENUM') as value2
from test 
where (calculated value2 -  calculated value1) le 2 ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;later I tried the follwoing code as adviced by Ksharp:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table test3 as 
select value1, value2
from test as a, test as b
where value1 =* value2 ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;I got following message in the log:&amp;nbsp;ERROR: The following columns were not found in the contributing tables: value1, value2. Being novice in SAS, I&amp;nbsp;am not understanding&amp;nbsp;the logic provided by Ksharp. Hence I did not altered the code to generate value 1 and value 2. &amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Can somebody help me further with this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for your kind support.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepak&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 18:46:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flag-records-having-a-specific-word-even-with-alteration-in/m-p/278279#M55974</guid>
      <dc:creator>DeepakSwain</dc:creator>
      <dc:date>2016-06-17T18:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: Flag records having a specific word even with alteration in spelling by one character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flag-records-having-a-specific-word-even-with-alteration-in/m-p/278286#M55977</link>
      <description>&lt;P&gt;You need to replace value1 and value2 variable references with the names of your actual variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's not a good idea to run code you don't understand, so I'd start by trying to understand the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Review the code&amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;and highlight the sections you don't understand and someone can help clarify. One good way to do this is to comment the code. Add comments for every proc/data step and even sections of them to highlight what they're doing. If you ever need to use this code again you'll probably be happy you did this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Quick comments regarding&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp﻿&lt;/a&gt;'s code, it's what's called a self join - you're joining each record in your dataset to every other record on the condition in the where clause (WHERE).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=* is the SOUNDS LIKE operator, or SOUNDEX&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/68089/HTML/default/viewer.htm#p0eaz2e63dlj17n1i5z17z3h84vp.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/68089/HTML/default/viewer.htm#p0eaz2e63dlj17n1i5z17z3h84vp.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 18:56:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flag-records-having-a-specific-word-even-with-alteration-in/m-p/278286#M55977</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-17T18:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Flag records having a specific word even with alteration in spelling by one character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flag-records-having-a-specific-word-even-with-alteration-in/m-p/278341#M55993</link>
      <description>&lt;PRE&gt;

proc sql;
create table test3 as 
select a.value1, b.value2
from test as a, test as b
where a.value1 =*  b.value2 ;
quit;
&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Jun 2016 06:57:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flag-records-having-a-specific-word-even-with-alteration-in/m-p/278341#M55993</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-06-18T06:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Flag records having a specific word even with alteration in spelling by one character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flag-records-having-a-specific-word-even-with-alteration-in/m-p/278699#M56076</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your advise as well as for explaining Ksharp's code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciated.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepak&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2016 14:39:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flag-records-having-a-specific-word-even-with-alteration-in/m-p/278699#M56076</guid>
      <dc:creator>DeepakSwain</dc:creator>
      <dc:date>2016-06-20T14:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: Flag records having a specific word even with alteration in spelling by one character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flag-records-having-a-specific-word-even-with-alteration-in/m-p/278702#M56078</link>
      <description>&lt;P&gt;Hi Ksharp,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your incredible guidance. With your as well as Reeza's guidance, I have customized the sas code as:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table test3 as 
select a.report, soundex(a.report) as value1, soundex(b.report) as value2
from test as a, test as b
where calculated value1 =*   calculated value2 ;
quit;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting this:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993366"&gt;Report &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;value1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; value2&lt;/FONT&gt;&lt;BR /&gt;STRICTURE IN THE GASTRODUODENAL JUNCTION &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; S36236532236335425235 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;S36236532236335425235&lt;BR /&gt;POLYP WITHOUT DYSPLASIA AT FIRST PART OF DUODENUM P4133321423162316313355 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;P4133321423162316313355&lt;BR /&gt;MULTIPLE ULCERS PRESENT IN THE DUODENOM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;M4314426216253533355 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;M4314426216253533355&lt;BR /&gt;ULCER OVER DUODENOL MUCOSA &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;U426163354522 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;U426163354522&lt;BR /&gt;NOTHING ABONRMALITY FOUND IN THE DUODENUM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;N352156543153533355 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;N352156543153533355&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you guide me further from this step. My expectation is to get a list of terms related to DUODENUM&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;DUODENUM&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;DUODENOM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;DUODENOL&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;Thank you in advance for your kind reply.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Deepak&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;</description>
      <pubDate>Mon, 20 Jun 2016 14:56:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flag-records-having-a-specific-word-even-with-alteration-in/m-p/278702#M56078</guid>
      <dc:creator>DeepakSwain</dc:creator>
      <dc:date>2016-06-20T14:56:44Z</dc:date>
    </item>
  </channel>
</rss>

