<?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: Extraction of multiple substrings (inclunding blanks) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extraction-of-multiple-substrings-inclunding-blanks/m-p/727368#M226209</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/365734"&gt;@irinabe&lt;/a&gt;&amp;nbsp;and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm sure we'll find a solution once a few points have been clarified:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The term "substring" is more general than "word." For example, "&lt;FONT face="courier new,courier"&gt;green&lt;/FONT&gt;" is a substring of "&lt;FONT face="courier new,courier"&gt;yellowish / greenish&lt;/FONT&gt;" and could be found therein by means of the FIND function, but not really with SCAN.&lt;/LI&gt;
&lt;LI&gt;A slightly different task would be to find the &lt;EM&gt;word&lt;/EM&gt; "&lt;FONT face="courier new,courier"&gt;dark&lt;/FONT&gt;" in the string "&lt;FONT face="courier new,courier"&gt;light green, dark blue&lt;/FONT&gt;" (but not in "&lt;FONT face="courier new,courier"&gt;darker&lt;/FONT&gt;") --&amp;nbsp;the &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p16rdsa30vmm43n1ej4936nwa01t.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;FINDW function&lt;/A&gt; would be suitable for this.&lt;/LI&gt;
&lt;LI&gt;Similarly, if the comma is defined as the word delimiter, then "&lt;FONT face="courier new,courier"&gt;food contents&lt;/FONT&gt;" can be found as a word in "&lt;SPAN&gt;&lt;FONT face="courier new,courier"&gt;white,food contents,slight&lt;/FONT&gt;" and with suitable code also in&amp;nbsp;"&lt;FONT face="courier new,courier"&gt;white, food contents, slight&lt;/FONT&gt;".&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;SPAN&gt; So, the first question is: Are your search terms of type 1, 2 or 3?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here's a slight modification of your code for handling type 3:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input clorres &amp;amp;$120.;
cards;
multiple, white, food contents, slight
red contents, milky, green contents, food contents, yellowish / greenish, dark blue
;

data want(drop=_:);
set have;
length test $120;
do _i=1 to countw(clorres,',');
  _s=scan(clorres,_i,',','r');
  if _s in ('yellowish / greenish', 'food contents', 'dark', 'green contents', 'milky',
            'pale', 'red contents', 'white contents', 'yellow contents')
  then test = catx(', ',test,_s);
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, is it possible that a search term occurs multiple times in CLORRES (e.g. "&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;dark&lt;/EM&gt; red, &lt;EM&gt;dark&lt;/EM&gt; blue&lt;/FONT&gt;") and, if so, would you like to see all those occurrences in variable TEST or just one?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Third, what about case sensitivity, e.g., should "&lt;FONT face="courier new,courier"&gt;dark&lt;/FONT&gt;" match "&lt;FONT face="courier new,courier"&gt;Dark&lt;/FONT&gt;"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT:&lt;/P&gt;
&lt;P&gt;A more general remark: Character variables containing lists of words are awkward to work with. (For example, &lt;FONT face="courier new,courier"&gt;"red, blue" ne "red,blue" ne "blue,red"&lt;/FONT&gt;.) Have you considered a "long" data structure where the comma separated terms occur as values of a shorter character variable in separate observations?&lt;/P&gt;</description>
    <pubDate>Thu, 18 Mar 2021 12:08:40 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2021-03-18T12:08:40Z</dc:date>
    <item>
      <title>Extraction of multiple substrings (inclunding blanks)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extraction-of-multiple-substrings-inclunding-blanks/m-p/727350#M226200</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;i spent a lot of time searching for a solution and tried a lot of the provided ideas, but no one worked for us. if i missed a good fitting answer, please feel free to point me into the right direction...&lt;/P&gt;&lt;P&gt;so, this is my first post ever, yay &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;our issue:&amp;nbsp;&lt;/P&gt;&lt;P&gt;we have a character variable ("CLORRES") containing a lot of words, some separated by blanks, some by comma, e.g. "multiple, white, food contents, slight"&lt;/P&gt;&lt;P&gt;we need to extract some specific substrings from this variable (and these substrings contain also blanks, e.g. "food contents" and "white") which can appear on multiple positions. Then these findings/hits need be concatenated into another variable ("SUPP").&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we tried:&lt;/P&gt;&lt;P&gt;scan (with different modifiers: q, s, t)&lt;/P&gt;&lt;P&gt;find (cant get it to work with a list of required subsstrings)&lt;/P&gt;&lt;P&gt;do loops&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;E.g.:&lt;/P&gt;&lt;PRE&gt;		/* Transfer of modifier "Csec" ("Color secretion") */
		/* (can appear on several positions) to SUPP: */
			DO i=1 to 20;
				IF SCAN(CLORRES,i,', ') IN ('yellowish / greenish','food contents', 'dark', 'green contents', 'milky', 'pale', 'red contents', 'white contents', 'yellow contents') THEN DO;
					SUPP = CATX(', ',test,SCAN(CLORRES,i,', ','t')); /* transfer of modifier to SUPP */
				END;	
			END;&lt;/PRE&gt;&lt;P&gt;the results:&lt;/P&gt;&lt;P&gt;some of the substrings containing blanks are extracted (like "red contents", "green contents"), some are not ("food contents", "yellowish / greenish"). Also, any hits after a hit are not found by this code (e.g. "red contents, milky" will end up as "red contents", missig the "milky)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we cant get to understand the logic behind this (but it seems to have to do something with blanks being a standard delimiter for SCAN) and of course, cant figure out a solution...&lt;/P&gt;&lt;P&gt;please let me know if you need for info or examples, i am happy to share.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One solution i did not yet try are the prx functions as i am completely new to these. If you say this would be the way, i am happy to learn. But hoping for an easier solution...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance, looking forward to any hints and discussions!&lt;/P&gt;&lt;P&gt;Best regards from Germany&lt;/P&gt;&lt;P&gt;Irina&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 11:42:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extraction-of-multiple-substrings-inclunding-blanks/m-p/727350#M226200</guid>
      <dc:creator>irinabe</dc:creator>
      <dc:date>2021-03-18T11:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Extraction of multiple substrings (inclunding blanks)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extraction-of-multiple-substrings-inclunding-blanks/m-p/727365#M226208</link>
      <description>&lt;P&gt;You have not supplied neither input test data nor list of sub-strings to look for and concatenate for output, nor the delimiter between the concatenated substrings .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may try next code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let strings = &amp;lt;list of strings separated by comma &amp;gt;;
/* Note - if comma may be in a substring then choose ther character like # */
%let dlm = &amp;lt;delimiter used between substrings&amp;gt;;

data want;
 set have;
 	 retain search nums;
     if _N_ = 1 then do;
        search = %quote(&amp;amp;strings);
		nums = countw(search,"&amp;amp;dlm");
	 end;
	 length new_var $100; /* adatpt to max length expected */
	 new_var = ' '; /* initialize for each observation */
	 do i=1 to nums;
	    if index(&amp;lt;varin&amp;gt;,scan(search,"&amp;amp;dlm",i)) &amp;gt; 0 then  
		   new_var = catx("&amp;amp;dlm",new_var,scan(search,"&amp;amp;dlm"),i);
	 end;
     keep new_var;  /* add any other wanted variable */
run;
	    &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 11:33:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extraction-of-multiple-substrings-inclunding-blanks/m-p/727365#M226208</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-03-18T11:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: Extraction of multiple substrings (inclunding blanks)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extraction-of-multiple-substrings-inclunding-blanks/m-p/727368#M226209</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/365734"&gt;@irinabe&lt;/a&gt;&amp;nbsp;and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm sure we'll find a solution once a few points have been clarified:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The term "substring" is more general than "word." For example, "&lt;FONT face="courier new,courier"&gt;green&lt;/FONT&gt;" is a substring of "&lt;FONT face="courier new,courier"&gt;yellowish / greenish&lt;/FONT&gt;" and could be found therein by means of the FIND function, but not really with SCAN.&lt;/LI&gt;
&lt;LI&gt;A slightly different task would be to find the &lt;EM&gt;word&lt;/EM&gt; "&lt;FONT face="courier new,courier"&gt;dark&lt;/FONT&gt;" in the string "&lt;FONT face="courier new,courier"&gt;light green, dark blue&lt;/FONT&gt;" (but not in "&lt;FONT face="courier new,courier"&gt;darker&lt;/FONT&gt;") --&amp;nbsp;the &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p16rdsa30vmm43n1ej4936nwa01t.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;FINDW function&lt;/A&gt; would be suitable for this.&lt;/LI&gt;
&lt;LI&gt;Similarly, if the comma is defined as the word delimiter, then "&lt;FONT face="courier new,courier"&gt;food contents&lt;/FONT&gt;" can be found as a word in "&lt;SPAN&gt;&lt;FONT face="courier new,courier"&gt;white,food contents,slight&lt;/FONT&gt;" and with suitable code also in&amp;nbsp;"&lt;FONT face="courier new,courier"&gt;white, food contents, slight&lt;/FONT&gt;".&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;SPAN&gt; So, the first question is: Are your search terms of type 1, 2 or 3?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here's a slight modification of your code for handling type 3:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input clorres &amp;amp;$120.;
cards;
multiple, white, food contents, slight
red contents, milky, green contents, food contents, yellowish / greenish, dark blue
;

data want(drop=_:);
set have;
length test $120;
do _i=1 to countw(clorres,',');
  _s=scan(clorres,_i,',','r');
  if _s in ('yellowish / greenish', 'food contents', 'dark', 'green contents', 'milky',
            'pale', 'red contents', 'white contents', 'yellow contents')
  then test = catx(', ',test,_s);
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, is it possible that a search term occurs multiple times in CLORRES (e.g. "&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;dark&lt;/EM&gt; red, &lt;EM&gt;dark&lt;/EM&gt; blue&lt;/FONT&gt;") and, if so, would you like to see all those occurrences in variable TEST or just one?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Third, what about case sensitivity, e.g., should "&lt;FONT face="courier new,courier"&gt;dark&lt;/FONT&gt;" match "&lt;FONT face="courier new,courier"&gt;Dark&lt;/FONT&gt;"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT:&lt;/P&gt;
&lt;P&gt;A more general remark: Character variables containing lists of words are awkward to work with. (For example, &lt;FONT face="courier new,courier"&gt;"red, blue" ne "red,blue" ne "blue,red"&lt;/FONT&gt;.) Have you considered a "long" data structure where the comma separated terms occur as values of a shorter character variable in separate observations?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 12:08:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extraction-of-multiple-substrings-inclunding-blanks/m-p/727368#M226209</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-03-18T12:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Extraction of multiple substrings (inclunding blanks)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extraction-of-multiple-substrings-inclunding-blanks/m-p/727388#M226221</link>
      <description>&lt;P&gt;Hi Shmuel,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your quick reply!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, i thought the information from the code was helpful enough to get a rough understanding of the issue.&lt;/P&gt;&lt;P&gt;List of substring to look for:&amp;nbsp;'yellowish / greenish','food contents', 'dark', 'green contents', 'milky', 'pale', 'red contents', 'white contents', 'yellow contents'&lt;/P&gt;&lt;P&gt;input test data: see screenshot&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="irinabe_0-1616071908464.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56103i5C633B1059C277E8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="irinabe_0-1616071908464.png" alt="irinabe_0-1616071908464.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Tried your code which looks very promising:&lt;/P&gt;&lt;PRE&gt;Data cl_test3;
set cl_3;
retain search nums;

%let strings = yellowish / greenish,food contents,dark;
/* Note - if comma may be in a substring then choose ther character like # */
%let dlm = ,;


 if _N_ = 1 then do;
    search = %quote(&amp;amp;strings);
	nums = countw(search,"&amp;amp;dlm");
 end;
 length new_var $200; /* adatpt to max length expected */
 new_var = ' '; /* initialize for each observation */
 do i=1 to nums;
    if index(CLORRES,scan(search,"&amp;amp;dlm",i)) &amp;gt; 0 then  
	   new_var = catx("&amp;amp;dlm",new_var,scan(search,"&amp;amp;dlm"),i);
 end;

RUN;&lt;/PRE&gt;&lt;P&gt;But the comma seems to cause trouble:&lt;/P&gt;&lt;PRE&gt;9309   Data cl_test3;
9310   set cl_3;
9311   retain search nums;
9312
9313   %let strings = yellowish / greenish,food contents,dark;
9314   /* Note - if comma may be in a substring then choose ther character like # */
9315   %let dlm = ,;
9316
9317
9318    if _N_ = 1 then do;
9319       search = %quote(&amp;amp;strings);
NOTE: Line generated by the macro variable "STRINGS".
1      yellowish / greenish,food contents,dark
                           -
                           388
                           76
ERROR 388-185: Expecting an arithmetic operator.

ERROR 76-322: Syntax error, statement will be ignored.

9320       nums = countw(search,"&amp;amp;dlm");
9321    end;&lt;/PRE&gt;&lt;P&gt;Did I do something wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Irina&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 12:55:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extraction-of-multiple-substrings-inclunding-blanks/m-p/727388#M226221</guid>
      <dc:creator>irinabe</dc:creator>
      <dc:date>2021-03-18T12:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: Extraction of multiple substrings (inclunding blanks)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extraction-of-multiple-substrings-inclunding-blanks/m-p/727454#M226254</link>
      <description>&lt;P&gt;As I see, each input observation has at most one one required substring. Is it?&lt;/P&gt;
&lt;P&gt;In such case there is no need to look for or concatenate input required substrings.&lt;/P&gt;
&lt;P&gt;Check next code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cl_3;
  input CLORRES $char80.;
cards;
discolored.redish
preset.condition.foamy.yellowish/greenish
preset.condition.mucous.white
preset.condition.foamy.yellowish/greenish
preset.condition.food contents.while
; run;

%let strings = yellowish / greenish,food contents,dark;
%let dlm = ,;

Data cl_test3;
 set cl_3;
     length search_for $20 search $140; /* adapt length if need */ 
	 retain search nums;
	 if _N_ = 1 then do;
	    search = "&amp;amp;strings"; /* assuming no double quotes in string */
        nums = countw(search,"&amp;amp;dlm"); put nums=;
	 end;
	 length new_var $200; /* adatpt to max length expected */
	 new_var = ' '; /* initialize for each observation */
	 do i=1 to nums;
	    search_for = strip(scan(search,i,"&amp;amp;dlm")); put search_for=; 
	    if index(CLORRES,strip(search_for)) &amp;gt; 0 then do; 
		   new_var = search_for;
		   output;
		end;
	 end;
     keep clorres new_var;
RUN;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;PAY ATTENTION -&lt;/P&gt;
&lt;P&gt;1) In the substring list you asked for "yellowish / greenish" (with spaces around the slash)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;while the input row is "preset.condition.foamy.&lt;STRONG&gt;yellowish/greenish&lt;/STRONG&gt;" (no spaces).&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;You have to adapt the list of substrings or use compress on both sides.&lt;/P&gt;
&lt;P&gt;2) Is your input data realy compressed, without spaces and the only delimiter between substrings is a dot "."?&lt;/P&gt;
&lt;P&gt;3) So we are talking about two different delimiters:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(1) delimiter used in %LET statement, separating required substrings&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(2) delimiter used in the input data to separate between the substrings.&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 15:51:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extraction-of-multiple-substrings-inclunding-blanks/m-p/727454#M226254</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-03-18T15:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Extraction of multiple substrings (inclunding blanks)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extraction-of-multiple-substrings-inclunding-blanks/m-p/727688#M226384</link>
      <description>&lt;P&gt;Hi to the both of you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wow, thanks for putting so much effort in this question, i am flashed &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you both, i tried all your suggestions, and Reinhard's code finally solved the problem.&lt;/P&gt;&lt;P&gt;This line here was the game changer:&amp;nbsp;&lt;/P&gt;&lt;PRE class="language-sas"&gt;&lt;CODE&gt;_s=scan(clorres,_i,',','r');&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data is rather like from Reinhard's point 1. Case senstitivity is not required, the values are always the same, in every occurence.&lt;/P&gt;&lt;P&gt;And you are sooo correct, working with these strings is awful!&lt;/P&gt;&lt;P&gt;But we cannot change anything about this as this is raw data from a legacy database.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again, thank you both so much for helping me out! You had great and creative apporaches, i really learned something from you!&lt;/P&gt;&lt;P&gt;Take care, best regards &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Irina&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 07:59:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extraction-of-multiple-substrings-inclunding-blanks/m-p/727688#M226384</guid>
      <dc:creator>irinabe</dc:creator>
      <dc:date>2021-03-19T07:59:40Z</dc:date>
    </item>
  </channel>
</rss>

