<?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 Within a Concatenated Variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Searching-Within-a-Concatenated-Variable/m-p/644143#M192360</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am very new to sas an trying to search within a concatenated var ("COMBINATION") which is in the form (product1 + product2 + product 3) for any part of the previously used combination.&amp;nbsp; I am trying to establish how many changes in combinations are a complete change (vs an addition to an existing regimen);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data completley_new_products;&lt;/P&gt;&lt;P&gt;set combination_products;&lt;/P&gt;&lt;P&gt;by cust_id combination;&lt;/P&gt;&lt;P&gt;lag_combination= lag(combination);&lt;/P&gt;&lt;P&gt;where combination not contains lag_combination;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help or guidance much appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Apr 2020 04:49:10 GMT</pubDate>
    <dc:creator>DLF22</dc:creator>
    <dc:date>2020-04-30T04:49:10Z</dc:date>
    <item>
      <title>Searching Within a Concatenated Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Searching-Within-a-Concatenated-Variable/m-p/644143#M192360</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am very new to sas an trying to search within a concatenated var ("COMBINATION") which is in the form (product1 + product2 + product 3) for any part of the previously used combination.&amp;nbsp; I am trying to establish how many changes in combinations are a complete change (vs an addition to an existing regimen);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data completley_new_products;&lt;/P&gt;&lt;P&gt;set combination_products;&lt;/P&gt;&lt;P&gt;by cust_id combination;&lt;/P&gt;&lt;P&gt;lag_combination= lag(combination);&lt;/P&gt;&lt;P&gt;where combination not contains lag_combination;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help or guidance much appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 04:49:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Searching-Within-a-Concatenated-Variable/m-p/644143#M192360</guid>
      <dc:creator>DLF22</dc:creator>
      <dc:date>2020-04-30T04:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Searching Within a Concatenated Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Searching-Within-a-Concatenated-Variable/m-p/644144#M192361</link>
      <description>&lt;P&gt;It is not clear what you have and what you expect as result. So please follow the guidelines and include data in usable form, see &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_blank" rel="nofollow noopener noreferrer noopener noreferrer"&gt;How to convert datasets to data steps&lt;/A&gt; for details.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 05:12:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Searching-Within-a-Concatenated-Variable/m-p/644144#M192361</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-04-30T05:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: Searching Within a Concatenated Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Searching-Within-a-Concatenated-Variable/m-p/644174#M192375</link>
      <description>&lt;P&gt;You will probably have to split the new combination into the various product codes, and check them one by one, something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data completely_new_products;
  set combination_products;
  by cust_id combination;
  lag_combination= lag(combination);
  if not first.cust_id then do _N_=1 to countw(combination);
    if indexw(lag_combination,scan(combination,_N_)) then
      delete;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Apr 2020 09:08:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Searching-Within-a-Concatenated-Variable/m-p/644174#M192375</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2020-04-30T09:08:19Z</dc:date>
    </item>
  </channel>
</rss>

