<?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: Using IF Then with wildcards in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-IF-Then-with-wildcards/m-p/789510#M252640</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if find(code,'03') then do;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 11 Jan 2022 16:21:51 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-01-11T16:21:51Z</dc:date>
    <item>
      <title>Using IF Then with wildcards</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-IF-Then-with-wildcards/m-p/789506#M252639</link>
      <description>&lt;P&gt;One of my variables is made up of long strings.&amp;nbsp; Similar to the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CODE&lt;/P&gt;&lt;P&gt;01|02|03|04|07|0A|0B|0C&lt;/P&gt;&lt;P&gt;01|02|03|04|05|0A|0B&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried using % wildcard operator, which works in SQL, but I couldn't get it to work in SAS.&amp;nbsp; I also tried using * which I had seen used in another similar question.&amp;nbsp; I would like to use an IF THEN statement to do the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF&amp;nbsp; CODE CONTAINS '03' THEN DO;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately only arithmetic operators can be used with IF THEN statements.&amp;nbsp; I considered using the SUBSTR function, but I don't know the starting position of the codes, they can change for each observation.&amp;nbsp; Any advice or ideas on how I can solve this issue?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jan 2022 16:22:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-IF-Then-with-wildcards/m-p/789506#M252639</guid>
      <dc:creator>Anthony_eng</dc:creator>
      <dc:date>2022-01-11T16:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF Then with wildcards</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-IF-Then-with-wildcards/m-p/789510#M252640</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if find(code,'03') then do;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Jan 2022 16:21:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-IF-Then-with-wildcards/m-p/789510#M252640</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-11T16:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF Then with wildcards</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-IF-Then-with-wildcards/m-p/789531#M252644</link>
      <description>&lt;P&gt;The wildcards only work with WHERE statements&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Take a look at &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/n0bj9p4401w3n9n1gmv6tf**bleep**9m.htm" target="_self"&gt;PRXMATCH Function&lt;/A&gt;, and the examples&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jan 2022 16:35:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-IF-Then-with-wildcards/m-p/789531#M252644</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2022-01-11T16:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF Then with wildcards</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-IF-Then-with-wildcards/m-p/789532#M252645</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/408097"&gt;@Anthony_eng&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;One of my variables is made up of long strings.&amp;nbsp; Similar to the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CODE&lt;/P&gt;
&lt;P&gt;01|02|03|04|07|0A|0B|0C&lt;/P&gt;
&lt;P&gt;01|02|03|04|05|0A|0B&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried using % wildcard operator, which works in SQL, but I couldn't get it to work in SAS.&amp;nbsp; I also tried using * which I had seen used in another similar question.&amp;nbsp; I would like to use an IF THEN statement to do the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF&amp;nbsp; CODE CONTAINS '03' THEN DO;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#800080"&gt;&lt;STRONG&gt;Unfortunately only arithmetic operators can be used with IF THEN statements.&amp;nbsp; I considered using the SUBSTR function, but I don't know the starting position of the codes, they can change for each observation.&amp;nbsp;&lt;/STRONG&gt; &lt;/FONT&gt;Any advice or ideas on how I can solve this issue?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;INDEXW/FINDW are functions you'll want.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FIND will find 01 within 001.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the statement in purple contradicts itself, not sure why you think "only arithmetic operators can be used with IF THEN statements".&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jan 2022 16:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-IF-Then-with-wildcards/m-p/789532#M252645</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-01-11T16:36:09Z</dc:date>
    </item>
  </channel>
</rss>

