<?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: check two strings for  occurances of a value using index or? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/check-two-strings-for-occurances-of-a-value-using-index-or/m-p/443064#M110823</link>
    <description>&lt;P&gt;Find (or index in your previously deleted post) can only search for one target string at a time.&lt;/P&gt;
&lt;P&gt;Your really should post code with errors from the log to show the details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that unless you are missing an additional rule anything that finds 'U' doesn't need to search for 'UU' as the singe U will be found in UU. If there were a third different string such a 'RW' then a third search would be needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;find(mhdxm_1,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;' '&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'U'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'UU'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)&amp;gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt; should be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;(find(mhdxm_1,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;' '&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)&amp;gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0 OR &lt;FONT face="Courier New" size="2"&gt;find(mhdxm_1,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'U'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)&amp;gt;&lt;/FONT&gt;0)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;exercise for the interested reader to complete the search of the other variable.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Mar 2018 21:28:30 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-03-06T21:28:30Z</dc:date>
    <item>
      <title>check two strings for  occurances of a value using index or?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-two-strings-for-occurances-of-a-value-using-index-or/m-p/443048#M110819</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to check tow strings for occurances of&amp;nbsp; blank, 'U', and 'UU'.&amp;nbsp; If both strings contain, then newvar ='Unknown'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried using find and Index...both getting error.&amp;nbsp; Can someone please tell me how to write this correctly?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; find(mhdxm_1,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;' '&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'U'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'UU'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)&amp;gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; and find(mhdxy_2,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;' '&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'U'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'UU'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)&amp;gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; mhendtc=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'UNKNOWN'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 21:09:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-two-strings-for-occurances-of-a-value-using-index-or/m-p/443048#M110819</guid>
      <dc:creator>jenim514</dc:creator>
      <dc:date>2018-03-06T21:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: check two strings for  occurances of a value using index or?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-two-strings-for-occurances-of-a-value-using-index-or/m-p/443064#M110823</link>
      <description>&lt;P&gt;Find (or index in your previously deleted post) can only search for one target string at a time.&lt;/P&gt;
&lt;P&gt;Your really should post code with errors from the log to show the details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that unless you are missing an additional rule anything that finds 'U' doesn't need to search for 'UU' as the singe U will be found in UU. If there were a third different string such a 'RW' then a third search would be needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;find(mhdxm_1,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;' '&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'U'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'UU'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)&amp;gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt; should be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;(find(mhdxm_1,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;' '&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)&amp;gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0 OR &lt;FONT face="Courier New" size="2"&gt;find(mhdxm_1,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'U'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)&amp;gt;&lt;/FONT&gt;0)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;exercise for the interested reader to complete the search of the other variable.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 21:28:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-two-strings-for-occurances-of-a-value-using-index-or/m-p/443064#M110823</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-06T21:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: check two strings for  occurances of a value using index or?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-two-strings-for-occurances-of-a-value-using-index-or/m-p/443065#M110824</link>
      <description>&lt;P&gt;Your second argument has to be what your looking for and FIND function can search only one instance.&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;if (find(mhdxm_1,'U','i')&amp;gt;0 and find(mhdxy_2,'U','i')&amp;gt;0)&amp;nbsp;OR&amp;nbsp;(find(mhdxm_1,'UU','i')&amp;gt;0 and find(mhdxy_2,'UU','i')&amp;gt;0) then mhendtc='UNKNOWN';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OR&amp;nbsp;&lt;/P&gt;&lt;P&gt;use prxmatch()&lt;/P&gt;&lt;P&gt;prxmatch("m/U|UU/oi,&lt;SPAN&gt;mhdxm_1)&amp;gt;0 or&amp;nbsp;prxmatch("m/U|UU/oi,mhdxm_2)&amp;gt;0&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 21:32:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-two-strings-for-occurances-of-a-value-using-index-or/m-p/443065#M110824</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-03-06T21:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: check two strings for  occurances of a value using index or?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-two-strings-for-occurances-of-a-value-using-index-or/m-p/443076#M110825</link>
      <description>&lt;P&gt;Is there any real reason to complicate this logic with the use of FIND?&amp;nbsp; Unless you have values that are right-hand-justified, you can simply use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;if mhdxm_1 in (' ' 'U' 'UU') and mhdxm_2 in (' ' 'U' 'UU') then mhendtc='UNKNOWN';&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Are things actually more complex than that?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 21:49:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-two-strings-for-occurances-of-a-value-using-index-or/m-p/443076#M110825</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-03-06T21:49:17Z</dc:date>
    </item>
  </channel>
</rss>

