<?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: Using Substring and scan function to pull number in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-Substring-and-scan-function-to-pull-number/m-p/429257#M27696</link>
    <description>&lt;P&gt;Another way, this 'kd' thing was shared by Art to me only yesterday &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;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  informat groupname $15.;
  input groupname;
  cards;
VIPER170891
HEAT170992
BULLS170691
;

data want;
set have;
want=substr(compress(strip(groupname),'','kd'),3,2) ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 19 Jan 2018 19:56:44 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-01-19T19:56:44Z</dc:date>
    <item>
      <title>Using Substring and scan function to pull number</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-Substring-and-scan-function-to-pull-number/m-p/429238#M27691</link>
      <description>&lt;P&gt;I am trying to extract the middle 2 numbers from the group names below:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;VIPER17&lt;STRONG&gt;08&lt;/STRONG&gt;91&lt;/LI&gt;&lt;LI&gt;HEAT17&lt;STRONG&gt;09&lt;/STRONG&gt;92&lt;/LI&gt;&lt;LI&gt;BULLS17&lt;STRONG&gt;06&lt;/STRONG&gt;91&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I applied the formula below; however, I am getting an error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;SUBSTR(RIGHT(SCAN(t1.GROUPNAME, -1, ' ')),4,2)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Can someone help ?&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Chris&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&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>Fri, 19 Jan 2018 19:12:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-Substring-and-scan-function-to-pull-number/m-p/429238#M27691</guid>
      <dc:creator>chrisjab</dc:creator>
      <dc:date>2018-01-19T19:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using Substring and scan function to pull number</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-Substring-and-scan-function-to-pull-number/m-p/429241#M27693</link>
      <description>&lt;P&gt;Here is one way:&lt;/P&gt;
&lt;PRE&gt;data have;
  informat groupname $15.;
  input groupname;
  want=substr(groupname,anydigit(groupname)+2,2);
  cards;
VIPER170891
HEAT170992
BULLS170691
;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2018 19:21:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-Substring-and-scan-function-to-pull-number/m-p/429241#M27693</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-01-19T19:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using Substring and scan function to pull number</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-Substring-and-scan-function-to-pull-number/m-p/429245#M27694</link>
      <description>&lt;P&gt;After posting my suggestion, I noticed that your initial code looked like it was pulled from a proc sql instance. If so, the following would work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  informat groupname $15.;
  input groupname;
  cards;
VIPER170891
HEAT170992
BULLS170691
;

proc sql;
  create table want as
    select substr(t1.groupname,anydigit(groupname)+2,2) as want
      from have t1
  ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2018 19:25:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-Substring-and-scan-function-to-pull-number/m-p/429245#M27694</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-01-19T19:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using Substring and scan function to pull number</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-Substring-and-scan-function-to-pull-number/m-p/429249#M27695</link>
      <description>&lt;P&gt;if your pattern holds true for all obs&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  informat groupname $15.;
  input groupname;
  want=reverse(substr(reverse(strip(groupname)),3,2));
  cards;
VIPER170891
HEAT170992
BULLS170691
;


/*if reading a dataset*/
data have;
 informat groupname $15.;
 input groupname;
 cards;
VIPER170891
HEAT170992
BULLS170691
;

data want;
set have;
want=reverse(substr(reverse(strip(groupname)),3,2));
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2018 19:45:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-Substring-and-scan-function-to-pull-number/m-p/429249#M27695</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-19T19:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using Substring and scan function to pull number</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-Substring-and-scan-function-to-pull-number/m-p/429257#M27696</link>
      <description>&lt;P&gt;Another way, this 'kd' thing was shared by Art to me only yesterday &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;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  informat groupname $15.;
  input groupname;
  cards;
VIPER170891
HEAT170992
BULLS170691
;

data want;
set have;
want=substr(compress(strip(groupname),'','kd'),3,2) ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Jan 2018 19:56:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-Substring-and-scan-function-to-pull-number/m-p/429257#M27696</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-19T19:56:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using Substring and scan function to pull number</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-Substring-and-scan-function-to-pull-number/m-p/429260#M27697</link>
      <description>&lt;P&gt;Thank you for your help; It worked !&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2018 20:07:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Using-Substring-and-scan-function-to-pull-number/m-p/429260#M27697</guid>
      <dc:creator>chrisjab</dc:creator>
      <dc:date>2018-01-19T20:07:08Z</dc:date>
    </item>
  </channel>
</rss>

