<?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: Easiest way to extract specific number - Scan or substring in proc SQL or data step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Easiest-way-to-extract-specific-number-Scan-or-substring-in-proc/m-p/744016#M233024</link>
    <description>&lt;P&gt;It sounds like you know the number that you are searching for in advance; is that correct?&amp;nbsp; If so, see the code below.&amp;nbsp; I'm using a combination of the FIND, LENGTH, and SUBSTR functions.&amp;nbsp; I'm sure there are other ways to do it as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimbarbour_0-1622057293236.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59792i15001644EAC36332/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jimbarbour_0-1622057293236.png" alt="jimbarbour_0-1622057293236.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA	_NULL_;
	Search_For	=	'27.59';
	Search_Len	=	LENGTHN(Search_For);
	Var			=	'Positive (27.59)';

	Number	=	SUBSTR(Var, FIND(Var,'27.59'), Search_Len);

	PUTLOG	"NOTE:  "  Number=;
	PUTLOG	"NOTE-  "  ;
RUN;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 26 May 2021 19:28:49 GMT</pubDate>
    <dc:creator>jimbarbour</dc:creator>
    <dc:date>2021-05-26T19:28:49Z</dc:date>
    <item>
      <title>Easiest way to extract specific number - Scan or substring in proc SQL or data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Easiest-way-to-extract-specific-number-Scan-or-substring-in-proc/m-p/744009#M233021</link>
      <description>&lt;P&gt;I would like to extract just the number 27.59 from the following&amp;nbsp;&lt;STRONG&gt;Positive (27.59).&lt;/STRONG&gt; Irrespective of the text before the parenthesis.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 19:17:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Easiest-way-to-extract-specific-number-Scan-or-substring-in-proc/m-p/744009#M233021</guid>
      <dc:creator>Stalk</dc:creator>
      <dc:date>2021-05-26T19:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: Easiest way to extract specific number - Scan or substring in proc SQL or data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Easiest-way-to-extract-specific-number-Scan-or-substring-in-proc/m-p/744011#M233023</link>
      <description>&lt;P&gt;SCAN() will work well as long as the text before (or after if searching backwards) does not include parentheses.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;number = input(scan(string,1,'()'),32.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 May 2021 19:21:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Easiest-way-to-extract-specific-number-Scan-or-substring-in-proc/m-p/744011#M233023</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-26T19:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: Easiest way to extract specific number - Scan or substring in proc SQL or data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Easiest-way-to-extract-specific-number-Scan-or-substring-in-proc/m-p/744016#M233024</link>
      <description>&lt;P&gt;It sounds like you know the number that you are searching for in advance; is that correct?&amp;nbsp; If so, see the code below.&amp;nbsp; I'm using a combination of the FIND, LENGTH, and SUBSTR functions.&amp;nbsp; I'm sure there are other ways to do it as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimbarbour_0-1622057293236.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59792i15001644EAC36332/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jimbarbour_0-1622057293236.png" alt="jimbarbour_0-1622057293236.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA	_NULL_;
	Search_For	=	'27.59';
	Search_Len	=	LENGTHN(Search_For);
	Var			=	'Positive (27.59)';

	Number	=	SUBSTR(Var, FIND(Var,'27.59'), Search_Len);

	PUTLOG	"NOTE:  "  Number=;
	PUTLOG	"NOTE-  "  ;
RUN;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 May 2021 19:28:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Easiest-way-to-extract-specific-number-Scan-or-substring-in-proc/m-p/744016#M233024</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-05-26T19:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: Easiest way to extract specific number - Scan or substring in proc SQL or data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Easiest-way-to-extract-specific-number-Scan-or-substring-in-proc/m-p/744024#M233027</link>
      <description>&lt;P&gt;Thank you Tom and Jim for the quick response.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used the following..ct_value= scan(Result,2,'()');&lt;/P&gt;
&lt;P&gt;I just need the number with in parenthesis for all the records.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 19:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Easiest-way-to-extract-specific-number-Scan-or-substring-in-proc/m-p/744024#M233027</guid>
      <dc:creator>Stalk</dc:creator>
      <dc:date>2021-05-26T19:48:35Z</dc:date>
    </item>
  </channel>
</rss>

