<?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: substring from a string (only first occurrence numeric values has to be removed) in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634743#M78005</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;Any ideas how to solve this by using prxchange() would be very helpful .&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Regular expressions are very resource hungry so if you can do it with simple string functions then that's often a better performing solution.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines truncover;
  input symptoms $150.;
  cards;
1. Over the past 1 months, I have coughed
2. Over the past 1 months, I have brought up phlegm (sputum):
3. Over the past 1 months, I have had shortness of breath:
4. Over the past 1 months, I have had attacks of wheezing:
5. During the past 1 months how many severe or very unpleasant attacks of chest trouble have you had?
6 How long did the worst attack of chest trouble last? (Go to question 7 if you had no severe attacks)
7. Over the past 1 months, in an average week, how many good days (with little chest trouble) have you had?
8. If you have a wheeze, is it worse in the morning?
If you have a wheeze, is it worse in the morning?
;

data want(drop=_:);
  set have;
  symptoms1=prxchange('s/^\d+[\. ]*//oi',1,strip(symptoms));
  if anydigit(symptoms)=1 then
    do;
      call scan(symptoms, 2, _pos, _len, ' ');
      symptoms2=substrn(symptoms,_pos);
    end;
  else symptoms2=symptoms;
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 25 Mar 2020 13:17:39 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2020-03-25T13:17:39Z</dc:date>
    <item>
      <title>substring from a string (only first occurrence numeric values has to be removed)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634738#M78002</link>
      <description>&lt;P&gt;I have&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data var;&lt;/P&gt;
&lt;P&gt;input symptoms;&lt;/P&gt;
&lt;P&gt;cards;&lt;/P&gt;
&lt;P&gt;1. Over the past 1 months, I have coughed&lt;BR /&gt;2. Over the past 1 months, I have brought up phlegm (sputum):&lt;BR /&gt;3. Over the past 1 months, I have had shortness of breath:&lt;BR /&gt;4. Over the past 1 months, I have had attacks of wheezing:&lt;BR /&gt;5. During the past 1 months how many severe or very unpleasant attacks of chest trouble have you had?&lt;BR /&gt;6 How long did the worst attack of chest trouble last? (Go to question 7 if you had no severe attacks)&lt;BR /&gt;7. Over the past 1 months, in an average week, how many good days (with little chest trouble) have you had?&lt;BR /&gt;8. If you have a wheeze, is it worse in the morning?&lt;/P&gt;
&lt;P&gt;;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i would like to extract the character part of the string by supressing 1. 2. 3. ......8. from the beginning of the string. it has to be removed in such a way that the 2nd or 3rd numeric value occurrences shouldn't be affected.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas how to solve this by using prxchange() would be very helpful .&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 12:58:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634738#M78002</guid>
      <dc:creator>sahoositaram555</dc:creator>
      <dc:date>2020-03-25T12:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: substring from a string (only first occurrence numeric values has to be removed)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634740#M78003</link>
      <description>&lt;P&gt;You could take advantage of the first space and using substr from that position&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data var;
infile cards truncover;
input symptoms $500.;

cards;
1. Over the past 1 months, I have coughed
2. Over the past 1 months, I have brought up phlegm (sputum):
3. Over the past 1 months, I have had shortness of breath:
4. Over the past 1 months, I have had attacks of wheezing:
5. During the past 1 months how many severe or very unpleasant attacks of chest trouble have you had?
6 How long did the worst attack of chest trouble last? (Go to question 7 if you had no severe attacks)
7. Over the past 1 months, in an average week, how many good days (with little chest trouble) have you had?
8. If you have a wheeze, is it worse in the morning?
;
run;

data want;
 set var;
 length want $500;
 want=substr(strip(symptoms),anyspace(symptoms)+1);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Mar 2020 13:04:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634740#M78003</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-03-25T13:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: substring from a string (only first occurrence numeric values has to be removed)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634743#M78005</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;Any ideas how to solve this by using prxchange() would be very helpful .&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Regular expressions are very resource hungry so if you can do it with simple string functions then that's often a better performing solution.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines truncover;
  input symptoms $150.;
  cards;
1. Over the past 1 months, I have coughed
2. Over the past 1 months, I have brought up phlegm (sputum):
3. Over the past 1 months, I have had shortness of breath:
4. Over the past 1 months, I have had attacks of wheezing:
5. During the past 1 months how many severe or very unpleasant attacks of chest trouble have you had?
6 How long did the worst attack of chest trouble last? (Go to question 7 if you had no severe attacks)
7. Over the past 1 months, in an average week, how many good days (with little chest trouble) have you had?
8. If you have a wheeze, is it worse in the morning?
If you have a wheeze, is it worse in the morning?
;

data want(drop=_:);
  set have;
  symptoms1=prxchange('s/^\d+[\. ]*//oi',1,strip(symptoms));
  if anydigit(symptoms)=1 then
    do;
      call scan(symptoms, 2, _pos, _len, ' ');
      symptoms2=substrn(symptoms,_pos);
    end;
  else symptoms2=symptoms;
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Mar 2020 13:17:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634743#M78005</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-03-25T13:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: substring from a string (only first occurrence numeric values has to be removed)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634748#M78006</link>
      <description>Hi @novoinosrin, Thank you for your rapid response . I can see that it's working. &lt;BR /&gt;I would like to understand it . So requesting you if please can explain to the below question it will be helpful. &lt;BR /&gt;in the statement anyspace(symptoms)+1 results in 4 and strip(symptoms) removes all the spaces so it considers it as a whole string. from a wholestring till 4th position if it reads then how +1 helps in this situtation to get the exact outpt, could you please explain.</description>
      <pubDate>Wed, 25 Mar 2020 13:35:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634748#M78006</guid>
      <dc:creator>sahoositaram555</dc:creator>
      <dc:date>2020-03-25T13:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: substring from a string (only first occurrence numeric values has to be removed)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634757#M78007</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just to "annoy" you.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data var;
infile cards truncover;
input symptoms $60.;

cards;
1. Over the past 1 months, I have coughed
Over the past 1 months, I have coughed
;

data want;
 set var;
 length want $500;
 want=substr(strip(symptoms),anyspace(symptoms)+1);
run;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1585144117865.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/37355iC3B091AA373044F9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1585144117865.png" alt="Patrick_0-1585144117865.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 13:48:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634757#M78007</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-03-25T13:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: substring from a string (only first occurrence numeric values has to be removed)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634758#M78008</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/109034"&gt;@sahoositaram555&lt;/a&gt;&amp;nbsp; I like the fact you are trying to understand the code. Very good attitude.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Honestly I didn't give much thought as I wrote that as for me SAS is merely a game, sometimes I hit and miss.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well, your understanding is correct. Basically&lt;/P&gt;
&lt;P&gt;1. anyspace(string) determines the position of the first space after the number and dot. The strip makes sure and leading spaces are removed before anyspace function executes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Once you have determined the position of the first blank space embedded in the string, the characters that follow the position of the first space ought to be the ones we need to extract&lt;/P&gt;
&lt;P&gt;3. +1 is to move the pointer to the next immediate position after the first blank space in order to avoid extracting the blank space causing leading blank spaces, albeit should you still have blank spaces the str after starting point, those would fall in the result of the extracted string&lt;/P&gt;
&lt;P&gt;4. I went with some assumptions like your string starts with numbers followed by dot and then a space and then follows the needed characters to extract&lt;/P&gt;
&lt;P&gt;5. If those assumptions hold true, the solution is rather simple and easy&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 13:50:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634758#M78008</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-03-25T13:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: substring from a string (only first occurrence numeric values has to be removed)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634759#M78009</link>
      <description>&lt;P&gt;Sir&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp; Yes I noticed that in your solution example as you modified the sample in the last dataline. However, that's the assumption I went with.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 13:52:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634759#M78009</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-03-25T13:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: substring from a string (only first occurrence numeric values has to be removed)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634761#M78010</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp; I really spotted your solution&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;If you have a wheeze, is it worse in the morning?&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and realized you wanted to offer a generic/holistic solution. Fair play &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; . Well i am far too lazy &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 14:05:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634761#M78010</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-03-25T14:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: substring from a string (only first occurrence numeric values has to be removed)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634786#M78020</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How about ANYALPHA() function?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines truncover;
  input symptoms $150.;
  cards;
1. Over the past 1 months, I have coughed
2. Over the past 1 months, I have brought up phlegm (sputum):
3. Over the past 1 months, I have had shortness of breath:
4. Over the past 1 months, I have had attacks of wheezing:
5. During the past 1 months how many severe or very unpleasant attacks of chest trouble have you had?
6 How long did the worst attack of chest trouble last? (Go to question 7 if you had no severe attacks)
7. Over the past 1 months, in an average week, how many good days (with little chest trouble) have you had?
8. If you have a wheeze, is it worse in the morning?
If you have a wheeze, is it worse in the morning?
;
run;

data want;
  set have;
  symptoms2=substrn(symptoms, anyalpha(symptoms));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All the best&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 15:24:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634786#M78020</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-03-25T15:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: substring from a string (only first occurrence numeric values has to be removed)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634848#M78026</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;, Thank you very much.</description>
      <pubDate>Wed, 25 Mar 2020 17:52:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634848#M78026</guid>
      <dc:creator>sahoositaram555</dc:creator>
      <dc:date>2020-03-25T17:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: substring from a string (only first occurrence numeric values has to be removed)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634892#M78029</link>
      <description>Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;. Thank you so much for showing me a way to deal this with redexp of perl. &lt;BR /&gt;I read and understood the statement prxchange('s/^\d+[\. ]*//oi',1,strip(symptoms)) except the  //oi part. I could guess that its making the search strategy case insensitive but what exactly o does and further by adding // which i read in a material that it is used for replacement ?&lt;BR /&gt;&lt;BR /&gt;could you please help me with your response to that 1 query of mine? Hope to hear from you soon.</description>
      <pubDate>Wed, 25 Mar 2020 20:49:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634892#M78029</guid>
      <dc:creator>sahoositaram555</dc:creator>
      <dc:date>2020-03-25T20:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: substring from a string (only first occurrence numeric values has to be removed)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634894#M78030</link>
      <description>Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt; for the update. Anyalpha is amazing .</description>
      <pubDate>Wed, 25 Mar 2020 20:53:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634894#M78030</guid>
      <dc:creator>sahoositaram555</dc:creator>
      <dc:date>2020-03-25T20:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: substring from a string (only first occurrence numeric values has to be removed)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634925#M78034</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/109034"&gt;@sahoositaram555&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;. Thank you so much for showing me a way to deal this with redexp of perl. &lt;BR /&gt;I read and understood the statement prxchange('s/^\d+[\. ]*//oi',1,strip(symptoms)) except the //oi part. I could guess that its making the search strategy case insensitive but what exactly o does and further by adding // which i read in a material that it is used for replacement ?&lt;BR /&gt;&lt;BR /&gt;could you please help me with your response to that 1 query of mine? Hope to hear from you soon.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT color="#003366"&gt;From a docu entry found&lt;/FONT&gt; &lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p1vz3ljudbd756n19502acxazevk.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;H3 id="n0cw1uzj8e88vpn10ba13g63be9t" class="xisDoc-title"&gt;Basic Syntax for Searching and Replacing Text&lt;/H3&gt;
&lt;P class="xisDoc-paragraph"&gt;The basic syntax for searching and replacing text has the following form:&lt;/P&gt;
&lt;PRE class="xisDoc-codeFragment"&gt;&lt;CODE&gt;s/&lt;EM class="xisDoc-userSuppliedValue"&gt;regular-expression&lt;/EM&gt;/&lt;EM class="xisDoc-userSuppliedValue"&gt;replacement-string&lt;/EM&gt;/ &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P class="xisDoc-paragraph"&gt;The following example uses the PRXCHANGE function to show how substitution is performed:&lt;/P&gt;
&lt;PRE class="xisDoc-codeFragment"&gt;&lt;CODE&gt;prxchange('s/world/planet/', 1, 'Hello world!'); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P class="xisDoc-paragraph"&gt;&lt;SPAN class="xisDoc-selection"&gt;Arguments&lt;/SPAN&gt;&lt;/P&gt;
&lt;DL class="xisDoc-listTermDef"&gt;
&lt;DT id="p1w77rf2hak06tn1gh928eor0qvs" class="xisDoc-term"&gt;s&lt;/DT&gt;
&lt;DD class="xisDoc-definition"&gt;
&lt;P class="xisDoc-paragraph"&gt;specifies the metacharacter for substitution.&lt;/P&gt;
&lt;/DD&gt;
&lt;DT id="n0cuvm8v5sjmdzn1jh4yriiz8rxz" class="xisDoc-term"&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;world&lt;/EM&gt;&lt;/DT&gt;
&lt;DD class="xisDoc-definition"&gt;
&lt;P class="xisDoc-paragraph"&gt;specifies the regular expression.&lt;/P&gt;
&lt;/DD&gt;
&lt;DT id="p0efqfkv5h69m1n14wv4lskrym2u" class="xisDoc-term"&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;planet&lt;/EM&gt;&lt;/DT&gt;
&lt;DD class="xisDoc-definition"&gt;
&lt;P class="xisDoc-paragraph"&gt;specifies the replacement value for&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;world&lt;/EM&gt;.&lt;/P&gt;
&lt;/DD&gt;
&lt;DT id="p1xsu9ze7pbvuyn16sxo9ry59b33" class="xisDoc-term"&gt;1&lt;/DT&gt;
&lt;DD class="xisDoc-definition"&gt;
&lt;P class="xisDoc-paragraph"&gt;specifies that the search ends when one match is found.&lt;/P&gt;
&lt;/DD&gt;
&lt;DT id="n05udwkz9wc4m7n1rd9n82n7eq0j" class="xisDoc-term"&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;Hello world!&lt;/EM&gt;&lt;/DT&gt;
&lt;DD class="xisDoc-definition"&gt;
&lt;P class="xisDoc-paragraph"&gt;specifies the source string to be searched.&lt;/P&gt;
&lt;/DD&gt;
&lt;/DL&gt;
&lt;P class="xisDoc-paragraph"&gt;The result of the substitution is&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="xisDoc-variableValue"&gt;Hello planet&lt;/CODE&gt;.&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;&lt;FONT color="#000080"&gt;&lt;EM&gt;"further by adding // which i read in a material that it is used for replacement"&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;&lt;FONT color="#000080"&gt;To just remove a matching string means to replace it with nothing. That's how you end up with two consecutive slashes.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;&lt;FONT color="#000080"&gt;&lt;EM&gt;"I could guess that its making the search strategy case insensitive but what exactly o does"&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;&lt;FONT color="#000080"&gt;- The i stands for case &lt;STRONG&gt;i&lt;/STRONG&gt;nsensitive&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;&lt;FONT color="#000080"&gt;- The o stands for only &lt;STRONG&gt;o&lt;/STRONG&gt;nce&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;&lt;FONT color="#000080"&gt;None of above two modifiers is required for the case here. I just made it a coding habit for myself to always add them unless there is a reason not to. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;&lt;FONT color="#000080"&gt;Searching for digits, dots and blanks only wouldn't require the &lt;STRONG&gt;i&lt;/STRONG&gt;, passing the regex as string to the function wouldn't require the &lt;STRONG&gt;o&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;&lt;FONT color="#000080"&gt;You only need the &lt;STRONG&gt;o&lt;/STRONG&gt; modifier if you use a SAS variable in the function and you want to avoid that the RegEx gets compiled in every single iteration of the data step.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 23:10:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/substring-from-a-string-only-first-occurrence-numeric-values-has/m-p/634925#M78034</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-03-25T23:10:28Z</dc:date>
    </item>
  </channel>
</rss>

