<?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: Replicate the Excel OR function in query builder computed column in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replicate-the-Excel-OR-function-in-query-builder-computed-column/m-p/412409#M26526</link>
    <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm essentially searching for a count of&amp;nbsp;any of the following text substrings within multiple variables, as shown below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Substring searching for:&lt;/P&gt;&lt;P&gt;RS005&lt;/P&gt;&lt;P&gt;RS006&lt;/P&gt;&lt;P&gt;RS005 - CONSUMER.PRIMARY&lt;/P&gt;&lt;P&gt;RS006 - CONSUMER.PRIMARY&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Variables to search within:&lt;/P&gt;&lt;P&gt;DECISIONOTHERCODE1&lt;/P&gt;&lt;P&gt;DECISIONOTHERCODE2&lt;/P&gt;&lt;P&gt;DECISIONOTHERCODE3&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;DECISIONOTHERCODE10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So if any of the substrings are found, it will return the count of all of them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is normally 0 or 1 but could be more than 1.&lt;/P&gt;</description>
    <pubDate>Fri, 10 Nov 2017 16:16:43 GMT</pubDate>
    <dc:creator>CWilson4815</dc:creator>
    <dc:date>2017-11-10T16:16:43Z</dc:date>
    <item>
      <title>Replicate the Excel OR function in query builder computed column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replicate-the-Excel-OR-function-in-query-builder-computed-column/m-p/412402#M26522</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am searching for a few substrings within some variables in my data table and would like to avoid setting up multiple computed columns to count each item before summing them all up at the end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, the following code works fine for returning the count of instances that 'RS006 - CONSUMER.PRIMARY' appears but I would like to expand this to search for 'RS005 - CONSUMER.PRIMARY', 'RS005' and 'RS006' all in one line of code for my query builder.&lt;/P&gt;&lt;PRE&gt;COUNT(CATX(',',DECISIONOTHERCODE1,DECISIONOTHERCODE2,DECISIONOTHERCODE3),'RS006 - CONSUMER.PRIMARY')&lt;/PRE&gt;&lt;P&gt;I would use the OR function in Excel to do this but I'm not sure what the equivalent is in SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I say I could set up multiple computed columns for each substring but I would like it to be a bit more efficient than that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Chris&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 16:02:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replicate-the-Excel-OR-function-in-query-builder-computed-column/m-p/412402#M26522</guid>
      <dc:creator>CWilson4815</dc:creator>
      <dc:date>2017-11-10T16:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate the Excel OR function in query builder computed column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replicate-the-Excel-OR-function-in-query-builder-computed-column/m-p/412406#M26525</link>
      <description>&lt;P&gt;I think you'll get better answers if you explain what you're trying to do and include sample data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are multiples to solve a problem and I suspect this is not the most efficient by far...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And yes, you can replicate the OR from Excel in SAS quite easily but I suspect in this case it's not a good solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A summary task with a filter may be a better option for example.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 16:09:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replicate-the-Excel-OR-function-in-query-builder-computed-column/m-p/412406#M26525</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-10T16:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate the Excel OR function in query builder computed column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replicate-the-Excel-OR-function-in-query-builder-computed-column/m-p/412409#M26526</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm essentially searching for a count of&amp;nbsp;any of the following text substrings within multiple variables, as shown below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Substring searching for:&lt;/P&gt;&lt;P&gt;RS005&lt;/P&gt;&lt;P&gt;RS006&lt;/P&gt;&lt;P&gt;RS005 - CONSUMER.PRIMARY&lt;/P&gt;&lt;P&gt;RS006 - CONSUMER.PRIMARY&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Variables to search within:&lt;/P&gt;&lt;P&gt;DECISIONOTHERCODE1&lt;/P&gt;&lt;P&gt;DECISIONOTHERCODE2&lt;/P&gt;&lt;P&gt;DECISIONOTHERCODE3&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;DECISIONOTHERCODE10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So if any of the substrings are found, it will return the count of all of them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is normally 0 or 1 but could be more than 1.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 16:16:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replicate-the-Excel-OR-function-in-query-builder-computed-column/m-p/412409#M26526</guid>
      <dc:creator>CWilson4815</dc:creator>
      <dc:date>2017-11-10T16:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate the Excel OR function in query builder computed column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replicate-the-Excel-OR-function-in-query-builder-computed-column/m-p/412412#M26527</link>
      <description>&lt;P&gt;Are you looking for a count of records or a count of instances?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ie if it's found in one variable DecisionOtherCode1, does it matter if it's in DecisionOtherCode99?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The easiest way to do this is to transpose your data to a long format and then use a single query. In general, having your data in a long format will make it easier to work with. Otherwise, an array within a data step is the next option.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SQL can do it, but it's the most verbose method.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you comfortable programming in SAS or are you using EG GUI?&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 16:20:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replicate-the-Excel-OR-function-in-query-builder-computed-column/m-p/412412#M26527</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-10T16:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate the Excel OR function in query builder computed column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replicate-the-Excel-OR-function-in-query-builder-computed-column/m-p/412417#M26528</link>
      <description>The way the data is presented, each substring will only ever be in one of the variables but there could be an occasion where both RS005 and RS006 are found for example. Which would mean that the value returned would be 2.&lt;BR /&gt;&lt;BR /&gt;I hope this is clear enough!&lt;BR /&gt;&lt;BR /&gt;I'm not comfortable with programming and would prefer to keep it within EG query builders for now if possible.</description>
      <pubDate>Fri, 10 Nov 2017 16:35:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replicate-the-Excel-OR-function-in-query-builder-computed-column/m-p/412417#M26528</guid>
      <dc:creator>CWilson4815</dc:creator>
      <dc:date>2017-11-10T16:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate the Excel OR function in query builder computed column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replicate-the-Excel-OR-function-in-query-builder-computed-column/m-p/412423#M26529</link>
      <description>&lt;P&gt;Then your best option is to use the TRANSPOSE task&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Change your data structure so you have the data in a long format&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DiagnosisOtherCode1 Value&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;DiagnosisOtherCode2 Value&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;DiagnosisOtherCode3 Value&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;DiagnosisOtherCode4 Value&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;DiagnosisOtherCode5 Value&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Then you can use the Query Builder and use the filter to filter out the results you want using contains.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Where value contains ('RS006') or value contains ('RS0005') etc.....&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 16:44:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replicate-the-Excel-OR-function-in-query-builder-computed-column/m-p/412423#M26529</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-10T16:44:54Z</dc:date>
    </item>
  </channel>
</rss>

