<?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: Extract key word from a composed reference in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extract-key-word-from-a-composed-reference/m-p/497398#M131822</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input var $50.;
cards;
0123456789 2547 IKEA
5874521 265935 ORANGE ASSUR 254 147
77745812 MERCEDES 25477
257CARREFOUR15 1254 774
;

data want;
set have;
want=strip(compress(var,' ','kai'));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 20 Sep 2018 14:40:41 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-09-20T14:40:41Z</dc:date>
    <item>
      <title>Extract key word from a composed reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-key-word-from-a-composed-reference/m-p/497388#M131815</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I spent the whole day looking for solution for my problem but with no issue &lt;img id="womansad" class="emoticon emoticon-womansad" src="https://communities.sas.com/i/smilies/16x16_woman-sad.png" alt="Woman Sad" title="Woman Sad" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a set of data which contains operations bank, i would like to extract only the name of the compagny or the business service&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it's very complicated because the&amp;nbsp;operation name is&amp;nbsp; a reference with lot of numbers and characters&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;operations&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;0123456789 2547 IKEA&lt;/P&gt;&lt;P&gt;5874521 265935 ORANGE ASSUR 254 147&lt;/P&gt;&lt;P&gt;77745812 MERCEDES 25477&lt;/P&gt;&lt;P&gt;257CARREFOUR15 1254 774&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i would like to obtain a colum like this bellow:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Result&lt;/P&gt;&lt;P&gt;IKEA&lt;/P&gt;&lt;P&gt;ORANGE ASSUR&lt;/P&gt;&lt;P&gt;MERCEDES&lt;/P&gt;&lt;P&gt;CARREFOUR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Seriously the person who&amp;nbsp;will find the solution for this would be a real Genius !!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance guys !! &lt;img id="womanhappy" class="emoticon emoticon-womanhappy" src="https://communities.sas.com/i/smilies/16x16_woman-happy.png" alt="Woman Happy" title="Woman Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 14:30:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-key-word-from-a-composed-reference/m-p/497388#M131815</guid>
      <dc:creator>Marwa_Se</dc:creator>
      <dc:date>2018-09-20T14:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Extract key word from a composed reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-key-word-from-a-composed-reference/m-p/497398#M131822</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input var $50.;
cards;
0123456789 2547 IKEA
5874521 265935 ORANGE ASSUR 254 147
77745812 MERCEDES 25477
257CARREFOUR15 1254 774
;

data want;
set have;
want=strip(compress(var,' ','kai'));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Sep 2018 14:40:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-key-word-from-a-composed-reference/m-p/497398#M131822</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-20T14:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: Extract key word from a composed reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-key-word-from-a-composed-reference/m-p/497409#M131830</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The easy way is to use prxchange to divide the string in tree elements, digits and blanks before first char, all chars and blanks up to first digit after, and the remaining digits/blanks, and&amp;nbsp;drop&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input var $char80.;
datalines;
0123456789 2547 IKEA
5874521 265935 ORANGE ASSUR 254 147
77745812 MERCEDES 25477
257CARREFOUR15 1254 774
;
run;
data want; set have; 
	length want $30;
	want = prxchange('s/([\d|\s]*)(\D*)([\d|\s]*)/$2/',-1,var);
	put want;
run;

IKEA
ORANGE ASSUR
MERCEDES
CARREFOUR

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;the first and third element. The supplied code works with your data, but there might be combinations it cannot handle..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 14:55:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-key-word-from-a-composed-reference/m-p/497409#M131830</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2018-09-20T14:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Extract key word from a composed reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-key-word-from-a-composed-reference/m-p/497414#M131834</link>
      <description>&lt;P&gt;Thank u a lo, it works but not for the whole references ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought that was related to the length because i can't obtain the whole name&lt;/P&gt;&lt;P&gt;for example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for this reference :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CARD BANK&amp;nbsp;000170999200&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i obtained ony : CARD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i added format var $100.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it doesn't work &lt;img id="womanfrustrated" class="emoticon emoticon-womanfrustrated" src="https://communities.sas.com/i/smilies/16x16_woman-frustrated.png" alt="Woman Frustrated" title="Woman Frustrated" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 14:59:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-key-word-from-a-composed-reference/m-p/497414#M131834</guid>
      <dc:creator>Marwa_Se</dc:creator>
      <dc:date>2018-09-20T14:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Extract key word from a composed reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-key-word-from-a-composed-reference/m-p/497417#M131835</link>
      <description>&lt;P&gt;That is weird. If I add CARD Bank, it works fine:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt; input var $char80.;&lt;BR /&gt;datalines;&lt;BR /&gt;0123456789 2547 IKEA&lt;BR /&gt;5874521 265935 ORANGE ASSUR 254 147&lt;BR /&gt;77745812 MERCEDES 25477&lt;BR /&gt;257CARREFOUR15 1254 774&lt;BR /&gt;CARD BANK 000170999200&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;data want; set have; &lt;BR /&gt; length want $30;&lt;BR /&gt; want = prxchange('s/([\d|\s]*)(\D*)([\d|\s]*)/$2/',-1,var);&lt;BR /&gt; put want;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IKEA&lt;BR /&gt;ORANGE ASSUR&lt;BR /&gt;MERCEDES&lt;BR /&gt;CARREFOUR&lt;BR /&gt;CARD BANK&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 15:03:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-key-word-from-a-composed-reference/m-p/497417#M131835</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2018-09-20T15:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Extract key word from a composed reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-key-word-from-a-composed-reference/m-p/497419#M131836</link>
      <description>&lt;P&gt;thank u so much, but it's very strange even your method doesn't work for some references&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i must have a problem with my database, i will focus ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again for your help &lt;img id="womanhappy" class="emoticon emoticon-womanhappy" src="https://communities.sas.com/i/smilies/16x16_woman-happy.png" alt="Woman Happy" title="Woman Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 15:07:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-key-word-from-a-composed-reference/m-p/497419#M131836</guid>
      <dc:creator>Marwa_Se</dc:creator>
      <dc:date>2018-09-20T15:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: Extract key word from a composed reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-key-word-from-a-composed-reference/m-p/497452#M131854</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/152332"&gt;@Marwa_Se&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;thank u so much, but it's very strange even your method doesn't work for some references&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i must have a problem with my database, i will focus ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you again for your help &lt;img id="womanhappy" class="emoticon emoticon-womanhappy" src="https://communities.sas.com/i/smilies/16x16_woman-happy.png" alt="Woman Happy" title="Woman Happy" /&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Realizing that the example data you provided may not exactly match your real data you might provide as much of an example from your "real" data that has problems.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some issues might be from encoding or possibly characters from the extended alphabet.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 16:31:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-key-word-from-a-composed-reference/m-p/497452#M131854</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-20T16:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: Extract key word from a composed reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-key-word-from-a-composed-reference/m-p/497712#M132018</link>
      <description>&lt;P&gt;Yes i adapted my database to the method and now it works perfectly &lt;img id="womanhappy" class="emoticon emoticon-womanhappy" src="https://communities.sas.com/i/smilies/16x16_woman-happy.png" alt="Woman Happy" title="Woman Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Sep 2018 07:20:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-key-word-from-a-composed-reference/m-p/497712#M132018</guid>
      <dc:creator>Marwa_Se</dc:creator>
      <dc:date>2018-09-21T07:20:03Z</dc:date>
    </item>
  </channel>
</rss>

