<?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 Searching the multiple words in a Variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Searching-the-multiple-words-in-a-Variable/m-p/593577#M170368</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have code the below logic to search the multiple words from the&amp;nbsp; comments variable(CMMT_X) but its not working properly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA TEST;&lt;BR /&gt;SET X (obs= 20);&lt;BR /&gt;Comments= upcase (CMMT_X);&lt;BR /&gt;X= INDEX(CMMT_X, "DECLINE IN PROPERTY");&lt;BR /&gt;/*x1= spedis(CMMT_X, "DECLINE IN PROPERTY");*/&lt;BR /&gt;got_value=SCAN(CMMT_X, "DECLINE","PROPERTY");&lt;/P&gt;&lt;P&gt;/**/&lt;BR /&gt;/* if index(CMMT_X,'DECLINE IN PROPERTY') or index(CMMT_X,'Decrease in Market Value')then RL_Group= 'Decrease to Security Value'; */&lt;BR /&gt;/* else if index(CMMT_X,'Customer Complaint') or index(CMMT_X,'Complaint') then RL_Group= 'Customer Complaint' ;*/&lt;BR /&gt;/* else if index(CMMT_X,'Customer Complaint') or index(CMMT_X,'Complaint') then RL_Group= 'Customer Complaint' ;*/&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if prxmatch("m/DECLINE IN PROPERTY|Decrease in Market Value|Security Value|security property|Property damaged|Property deteriorated|Valuer Error/oi",CMMT_X) &amp;gt; 0 then found='Decrease to Security Value';&lt;BR /&gt;else if prxmatch("m/Customer Complaint|'Complaint/oi",CMMT_X) &amp;gt; 0 then found='Customer Complaint';&lt;BR /&gt;else if prxmatch("m/Fraud/oi",CMMT_X) &amp;gt; 0 then found='Fraud'; /* Fraud Internal / Fraud External */&lt;BR /&gt;else if prxmatch("m/LMI Claim due|No LMI| Delays with MIP|Non-Fair Wear and Tear / oi",CMMT_X) &amp;gt; 0 then found='LMI Claim Reduction';&lt;BR /&gt;else if prxmatch("m/Project Jefferson | Project Storm / oi",CMMT_X) &amp;gt; 0 then found='Project Jefferson';&lt;BR /&gt;else if prxmatch("m/Project Alton/ oi",CMMT_X) &amp;gt; 0 then found='Project Alton';&lt;BR /&gt;else if prxmatch("m/Process Error|Error / oi",CMMT_X) &amp;gt; 0 then found='Process Error';&lt;BR /&gt;/*|Funds credited to incorrect account|LMI maladministration|LMI Premium not paid|Release of security for nil consideration|Lender error - LVR miscalculation|Credit Officer - LVR miscalculation | Other HL funding issue | VLOC Limit not Cancelled |Lender Error - Unacceptable Security | LMI Missing documentation |Credit Officer - unacceptable security|Lender Committed | Loan not Secured at Origination |Missing security documentation |Construction Loan Progress Payments|VLOC Limit not Reduced |Lender error - missing documentation|Lender Error - Maladministration |Credit Officer - Approved Outside Policy/Poor Credit Decision | Poor Credit Maladministration |Lender Error - Maladministration |Missing security documentation | VLOC Limit not Cancelled | Other HL funding issue | Other LMI issue */&lt;BR /&gt;else if prxmatch("m/Provision Raised in Error|Provision Raised Error|LMI Claim should be lodged |Provision not required|LMI Claim should be lodged / oi",CMMT_X) &amp;gt; 0 then found='Provision Raised in Error';&lt;BR /&gt;else if prxmatch("m/Incomplete Building Loan|Builder/ oi",CMMT_X) &amp;gt; 0 then found='Incomplete Building Loan';&lt;BR /&gt;else if prxmatch("m/Uninsured Property|No building insurance|Fire Damage/ oi",CMMT_X) &amp;gt; 0 then found='Uninsured Property';&lt;BR /&gt;else if prxmatch("m/Valuation Procedures|Non-System Ordered Valuation|Incorrect Source Document | Incorrect Source Valuation |Incorrect Source|VAS decision not followed|Incorrect VAS input / oi",CMMT_X) &amp;gt; 0 then found='Valuation Procedures';&lt;BR /&gt;else found='Miscellaneous';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any other better way to write.Instead of prxmatch is index better?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate your help.thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Oct 2019 01:41:58 GMT</pubDate>
    <dc:creator>BaalaRaaji</dc:creator>
    <dc:date>2019-10-03T01:41:58Z</dc:date>
    <item>
      <title>Searching the multiple words in a Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Searching-the-multiple-words-in-a-Variable/m-p/593577#M170368</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have code the below logic to search the multiple words from the&amp;nbsp; comments variable(CMMT_X) but its not working properly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA TEST;&lt;BR /&gt;SET X (obs= 20);&lt;BR /&gt;Comments= upcase (CMMT_X);&lt;BR /&gt;X= INDEX(CMMT_X, "DECLINE IN PROPERTY");&lt;BR /&gt;/*x1= spedis(CMMT_X, "DECLINE IN PROPERTY");*/&lt;BR /&gt;got_value=SCAN(CMMT_X, "DECLINE","PROPERTY");&lt;/P&gt;&lt;P&gt;/**/&lt;BR /&gt;/* if index(CMMT_X,'DECLINE IN PROPERTY') or index(CMMT_X,'Decrease in Market Value')then RL_Group= 'Decrease to Security Value'; */&lt;BR /&gt;/* else if index(CMMT_X,'Customer Complaint') or index(CMMT_X,'Complaint') then RL_Group= 'Customer Complaint' ;*/&lt;BR /&gt;/* else if index(CMMT_X,'Customer Complaint') or index(CMMT_X,'Complaint') then RL_Group= 'Customer Complaint' ;*/&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if prxmatch("m/DECLINE IN PROPERTY|Decrease in Market Value|Security Value|security property|Property damaged|Property deteriorated|Valuer Error/oi",CMMT_X) &amp;gt; 0 then found='Decrease to Security Value';&lt;BR /&gt;else if prxmatch("m/Customer Complaint|'Complaint/oi",CMMT_X) &amp;gt; 0 then found='Customer Complaint';&lt;BR /&gt;else if prxmatch("m/Fraud/oi",CMMT_X) &amp;gt; 0 then found='Fraud'; /* Fraud Internal / Fraud External */&lt;BR /&gt;else if prxmatch("m/LMI Claim due|No LMI| Delays with MIP|Non-Fair Wear and Tear / oi",CMMT_X) &amp;gt; 0 then found='LMI Claim Reduction';&lt;BR /&gt;else if prxmatch("m/Project Jefferson | Project Storm / oi",CMMT_X) &amp;gt; 0 then found='Project Jefferson';&lt;BR /&gt;else if prxmatch("m/Project Alton/ oi",CMMT_X) &amp;gt; 0 then found='Project Alton';&lt;BR /&gt;else if prxmatch("m/Process Error|Error / oi",CMMT_X) &amp;gt; 0 then found='Process Error';&lt;BR /&gt;/*|Funds credited to incorrect account|LMI maladministration|LMI Premium not paid|Release of security for nil consideration|Lender error - LVR miscalculation|Credit Officer - LVR miscalculation | Other HL funding issue | VLOC Limit not Cancelled |Lender Error - Unacceptable Security | LMI Missing documentation |Credit Officer - unacceptable security|Lender Committed | Loan not Secured at Origination |Missing security documentation |Construction Loan Progress Payments|VLOC Limit not Reduced |Lender error - missing documentation|Lender Error - Maladministration |Credit Officer - Approved Outside Policy/Poor Credit Decision | Poor Credit Maladministration |Lender Error - Maladministration |Missing security documentation | VLOC Limit not Cancelled | Other HL funding issue | Other LMI issue */&lt;BR /&gt;else if prxmatch("m/Provision Raised in Error|Provision Raised Error|LMI Claim should be lodged |Provision not required|LMI Claim should be lodged / oi",CMMT_X) &amp;gt; 0 then found='Provision Raised in Error';&lt;BR /&gt;else if prxmatch("m/Incomplete Building Loan|Builder/ oi",CMMT_X) &amp;gt; 0 then found='Incomplete Building Loan';&lt;BR /&gt;else if prxmatch("m/Uninsured Property|No building insurance|Fire Damage/ oi",CMMT_X) &amp;gt; 0 then found='Uninsured Property';&lt;BR /&gt;else if prxmatch("m/Valuation Procedures|Non-System Ordered Valuation|Incorrect Source Document | Incorrect Source Valuation |Incorrect Source|VAS decision not followed|Incorrect VAS input / oi",CMMT_X) &amp;gt; 0 then found='Valuation Procedures';&lt;BR /&gt;else found='Miscellaneous';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any other better way to write.Instead of prxmatch is index better?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate your help.thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2019 01:41:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Searching-the-multiple-words-in-a-Variable/m-p/593577#M170368</guid>
      <dc:creator>BaalaRaaji</dc:creator>
      <dc:date>2019-10-03T01:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: Searching the multiple words in a Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Searching-the-multiple-words-in-a-Variable/m-p/593582#M170371</link>
      <description>&lt;P&gt;1.&lt;EM&gt;&amp;nbsp;its not working properly.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;How?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2.&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/SPAN&gt;&lt;EM&gt;Is there any other better way to write.Instead of prxmatch is index better?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Index() or find() would be much faster. Find() allows for case-insensitive matches, index() doesn't.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3.You seem to have typos in your values:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;"m/Customer Complaint|'Complaint/oi"&amp;nbsp;&lt;/FONT&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Do you want to test for the single quote?&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;"m/Project Jefferson | Project Storm / oi"&amp;nbsp;&lt;/FONT&gt; Do you want to test for the space?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. You are not using the scan function properly.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2019 03:27:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Searching-the-multiple-words-in-a-Variable/m-p/593582#M170371</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-10-03T03:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Searching the multiple words in a Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Searching-the-multiple-words-in-a-Variable/m-p/593585#M170373</link>
      <description>&lt;P&gt;Thanks Chris..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code is working, there is no issue with quotation marks..only problem is it is not checking all the similar words that i am looking on the each groupings...below example..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if prxmatch("m/Provision Raised in Error|Provision Raised Error|LMI Claim should be lodged |Provision not required|LMI Claim should be lodged / oi",CMMT_X) &amp;gt; 0 then found='Provision Raised in Error'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks only for one word not working for multiple word search...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did use Index but that not giving 100% result too..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So thought is any other better way to search multiple words in SAS?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2019 03:43:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Searching-the-multiple-words-in-a-Variable/m-p/593585#M170373</guid>
      <dc:creator>BaalaRaaji</dc:creator>
      <dc:date>2019-10-03T03:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Searching the multiple words in a Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Searching-the-multiple-words-in-a-Variable/m-p/593587#M170375</link>
      <description>&lt;P&gt;My mentioning the quote and space is not about the code not running, it's about your match being impaired.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have no clue what you are trying to match. Only you know.&lt;/P&gt;
&lt;P&gt;Something like this gives more flexibility:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;prxmatch("m/Provision.*Error|Claim.*(not|should).*lodged|Provision.*required/oi",CMMT_X)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2019 04:03:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Searching-the-multiple-words-in-a-Variable/m-p/593587#M170375</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-10-03T04:03:19Z</dc:date>
    </item>
  </channel>
</rss>

