<?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: how to extract particular string from the variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-extract-particular-string-from-the-variable/m-p/452312#M114139</link>
    <description>&lt;P&gt;one way to do this&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input var $20.;
datalines;
IE_INCL001G_9
IE_INCL001G_4
IE_INCL001G_19
IE_EXCL001G_3
IE_EXCL001G_1
;

data want;

set have;

newvar= cats(substr(scan(var,2,"_"),1,4),put(input(scan(var,3,"_"),2.),z2.));

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 08 Apr 2018 13:05:23 GMT</pubDate>
    <dc:creator>kiranv_</dc:creator>
    <dc:date>2018-04-08T13:05:23Z</dc:date>
    <item>
      <title>how to extract particular string from the variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-extract-particular-string-from-the-variable/m-p/452302#M114136</link>
      <description>&lt;P&gt;I have a variable which has data like&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IE_INCL001G_9&lt;/P&gt;
&lt;P&gt;IE_INCL001G_4&lt;/P&gt;
&lt;P&gt;IE_INCL001G_19&lt;/P&gt;
&lt;P&gt;IE_EXCL001G_3&lt;/P&gt;
&lt;P&gt;IE_EXCL001G_1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need data like INCL_09,.......EXCL_01, so need to extract INCL and EXCL and numbers at last with format as 2. means 9 should be 09.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;any help please&lt;/P&gt;</description>
      <pubDate>Sun, 08 Apr 2018 10:08:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-extract-particular-string-from-the-variable/m-p/452302#M114136</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2018-04-08T10:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract particular string from the variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-extract-particular-string-from-the-variable/m-p/452312#M114139</link>
      <description>&lt;P&gt;one way to do this&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input var $20.;
datalines;
IE_INCL001G_9
IE_INCL001G_4
IE_INCL001G_19
IE_EXCL001G_3
IE_EXCL001G_1
;

data want;

set have;

newvar= cats(substr(scan(var,2,"_"),1,4),put(input(scan(var,3,"_"),2.),z2.));

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Apr 2018 13:05:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-extract-particular-string-from-the-variable/m-p/452312#M114139</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-04-08T13:05:23Z</dc:date>
    </item>
  </channel>
</rss>

