<?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 IF THEN ELSE using wildcards in an open text variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/IF-THEN-ELSE-using-wildcards-in-an-open-text-variable/m-p/684318#M207361</link>
    <description>&lt;P&gt;Good afternoon,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working through trying to create a new variable based on possible text in an open text field from a previously created table with little success.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This first piece of code is working as desired.&amp;nbsp; It is giving results of an item_identifier and then note(s) associated with it that contain one of the 4 specific pieces of text as indicated.&amp;nbsp; The table_notes.note variable is open text from an Oracle database, as an FYI.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table NOTES_KEYWORD as&lt;BR /&gt;select table_cases.item_identifier&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ,table_notes.note&lt;BR /&gt;&lt;BR /&gt;from libone.table_cases&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ,libone.table_case_audits&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ,libone.table_audits&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ,libone.table_notes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where table_cases.item_internal_id = table_case_audits.item_internal_id&lt;BR /&gt;and table_case_audits.item_audit_internal_id = table_audits.item_audit_internal_id&lt;BR /&gt;and table_audits.item_audit_internal_id = table_notes.item_audit_internal_id&lt;BR /&gt;and table_cases.item_identifier like '20__C%'&lt;BR /&gt;and (table_cases.case_date &amp;gt;= '01jun2020'd&lt;BR /&gt;and table_cases.case_date &amp;lt; '01aug2020'd)&lt;BR /&gt;and (upcase(table_notes.note) like '%ZELLE%'&lt;BR /&gt;or upcase(table_notes.note) like '%CASHEDGE%'&lt;BR /&gt;or upcase(table_notes.note) like '%PAYPOINT%'&lt;BR /&gt;or upcase(table_notes.note) like '%FDR%')&lt;/P&gt;&lt;P&gt;order by table_notes.create_date;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'm wanting to do next is create a new variable (note2) from the existing note variable using one of the 4 text snippets, as appropriate:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data notes_keyword_final;&lt;BR /&gt;set notes_keyword;&lt;/P&gt;&lt;P&gt;if upcase(note) =: 'ZELLE' then NOTE2='ZELLE';&lt;BR /&gt;else if upcase(note) =: 'CASHEDGE' then NOTE2='CASHEDGE';&lt;BR /&gt;else if upcase(note) =: 'PAYPOINT' then NOTE2='PAYPOINT';&lt;BR /&gt;else if upcase(note) =: 'FDR' then NOTE2='FDR';&lt;/P&gt;&lt;P&gt;drop note;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This produces the list of item_identifiers, but nothing populated in the note2 variable.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot substr the initial note as it is open text and the text string may appear anywhere therein.&amp;nbsp; Likewise, delimiting is not possible as it is not preceded by any exclusive formatting.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for any and all assistance rendered.&amp;nbsp; Always a lot of help on this site.&amp;nbsp; It is GREATLY appreciated.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Sep 2020 17:01:28 GMT</pubDate>
    <dc:creator>hnb_matt_d</dc:creator>
    <dc:date>2020-09-16T17:01:28Z</dc:date>
    <item>
      <title>IF THEN ELSE using wildcards in an open text variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-THEN-ELSE-using-wildcards-in-an-open-text-variable/m-p/684318#M207361</link>
      <description>&lt;P&gt;Good afternoon,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working through trying to create a new variable based on possible text in an open text field from a previously created table with little success.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This first piece of code is working as desired.&amp;nbsp; It is giving results of an item_identifier and then note(s) associated with it that contain one of the 4 specific pieces of text as indicated.&amp;nbsp; The table_notes.note variable is open text from an Oracle database, as an FYI.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table NOTES_KEYWORD as&lt;BR /&gt;select table_cases.item_identifier&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ,table_notes.note&lt;BR /&gt;&lt;BR /&gt;from libone.table_cases&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ,libone.table_case_audits&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ,libone.table_audits&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ,libone.table_notes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where table_cases.item_internal_id = table_case_audits.item_internal_id&lt;BR /&gt;and table_case_audits.item_audit_internal_id = table_audits.item_audit_internal_id&lt;BR /&gt;and table_audits.item_audit_internal_id = table_notes.item_audit_internal_id&lt;BR /&gt;and table_cases.item_identifier like '20__C%'&lt;BR /&gt;and (table_cases.case_date &amp;gt;= '01jun2020'd&lt;BR /&gt;and table_cases.case_date &amp;lt; '01aug2020'd)&lt;BR /&gt;and (upcase(table_notes.note) like '%ZELLE%'&lt;BR /&gt;or upcase(table_notes.note) like '%CASHEDGE%'&lt;BR /&gt;or upcase(table_notes.note) like '%PAYPOINT%'&lt;BR /&gt;or upcase(table_notes.note) like '%FDR%')&lt;/P&gt;&lt;P&gt;order by table_notes.create_date;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'm wanting to do next is create a new variable (note2) from the existing note variable using one of the 4 text snippets, as appropriate:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data notes_keyword_final;&lt;BR /&gt;set notes_keyword;&lt;/P&gt;&lt;P&gt;if upcase(note) =: 'ZELLE' then NOTE2='ZELLE';&lt;BR /&gt;else if upcase(note) =: 'CASHEDGE' then NOTE2='CASHEDGE';&lt;BR /&gt;else if upcase(note) =: 'PAYPOINT' then NOTE2='PAYPOINT';&lt;BR /&gt;else if upcase(note) =: 'FDR' then NOTE2='FDR';&lt;/P&gt;&lt;P&gt;drop note;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This produces the list of item_identifiers, but nothing populated in the note2 variable.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot substr the initial note as it is open text and the text string may appear anywhere therein.&amp;nbsp; Likewise, delimiting is not possible as it is not preceded by any exclusive formatting.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for any and all assistance rendered.&amp;nbsp; Always a lot of help on this site.&amp;nbsp; It is GREATLY appreciated.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2020 17:01:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-THEN-ELSE-using-wildcards-in-an-open-text-variable/m-p/684318#M207361</guid>
      <dc:creator>hnb_matt_d</dc:creator>
      <dc:date>2020-09-16T17:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN ELSE using wildcards in an open text variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-THEN-ELSE-using-wildcards-in-an-open-text-variable/m-p/684319#M207362</link>
      <description>&lt;P&gt;Use the INDEX function to check if a string is present in another.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2020 17:03:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-THEN-ELSE-using-wildcards-in-an-open-text-variable/m-p/684319#M207362</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-09-16T17:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN ELSE using wildcards in an open text variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-THEN-ELSE-using-wildcards-in-an-open-text-variable/m-p/684320#M207363</link>
      <description>&lt;P&gt;The FIND() function also works in this situation. And optionally can operate in case-insensitive mode.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2020 17:13:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-THEN-ELSE-using-wildcards-in-an-open-text-variable/m-p/684320#M207363</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-09-16T17:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN ELSE using wildcards in an open text variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-THEN-ELSE-using-wildcards-in-an-open-text-variable/m-p/684323#M207366</link>
      <description>&lt;P&gt;Symbol "=:" is a begins-with operator, but your inputs have something else at start&amp;nbsp; (e.g., "&lt;STRONG&gt;%&lt;/STRONG&gt;Zelle%"), which is probably why its not seeing them.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2020 17:14:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-THEN-ELSE-using-wildcards-in-an-open-text-variable/m-p/684323#M207366</guid>
      <dc:creator>pink_poodle</dc:creator>
      <dc:date>2020-09-16T17:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN ELSE using wildcards in an open text variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-THEN-ELSE-using-wildcards-in-an-open-text-variable/m-p/684668#M207522</link>
      <description>&lt;P&gt;Currently working through suggestions provided.&amp;nbsp; Will update with final (working) code when it's developed.&amp;nbsp; THANKS!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 15:37:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-THEN-ELSE-using-wildcards-in-an-open-text-variable/m-p/684668#M207522</guid>
      <dc:creator>hnb_matt_d</dc:creator>
      <dc:date>2020-09-17T15:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN ELSE using wildcards in an open text variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-THEN-ELSE-using-wildcards-in-an-open-text-variable/m-p/684784#M207582</link>
      <description>&lt;P&gt;This code is giving me what I'm wanting:&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table NOTES_KEYWORD as&lt;BR /&gt;select table_cases.item_identifier&lt;BR /&gt;,case when upcase(table_notes.note) like '%ZELLE%' then 'ZELLE'&lt;BR /&gt;when upcase(table_notes.note) like '%CASHEDGE%' then 'CASHEDGE'&lt;BR /&gt;when upcase(table_notes.note) like '%MOBILE%' then 'MOBILE'&lt;BR /&gt;else 'OTHER'&lt;BR /&gt;end as NOTE2&lt;BR /&gt;&lt;BR /&gt;from libone.table_cases&lt;BR /&gt;,libone.table_case_audits&lt;BR /&gt;,libone.table_audits&lt;BR /&gt;,libone.table_notes&lt;/P&gt;&lt;P&gt;where table_cases.item_internal_id = table_case_audits.item_internal_id&lt;BR /&gt;and table_case_audits.item_audit_internal_id = table_audits.item_audit_internal_id&lt;BR /&gt;and table_audits.item_audit_internal_id = table_notes.item_audit_internal_id&lt;BR /&gt;and table_cases.item_identifier like '20__C%'&lt;BR /&gt;and (table_cases.case_date &amp;gt;= '01jun2020'd&lt;BR /&gt;and table_cases.case_date &amp;lt; '01aug2020'd)&lt;BR /&gt;and (upcase(table_notes.note) like '%ZELLE%'&lt;BR /&gt;or upcase(table_notes.note) like '%CASHEDGE%'&lt;BR /&gt;or upcase(table_notes.note) like '%MOBILE%')&lt;/P&gt;&lt;P&gt;order by table_notes.create_date;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 20:01:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-THEN-ELSE-using-wildcards-in-an-open-text-variable/m-p/684784#M207582</guid>
      <dc:creator>hnb_matt_d</dc:creator>
      <dc:date>2020-09-17T20:01:17Z</dc:date>
    </item>
  </channel>
</rss>

