<?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: SUBSTR remove all letter in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SUBSTR-remove-all-letter/m-p/467443#M119320</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Have;

input id $20.;
cards;
1111-000001KK
1111-000002IM
1111-000003IM
1111-000011IM
1111-000111IM
1111-000221IM
1111-000331IM
1111-000441IM
1111-000002IM
IM-1111-000644
IM-1111-001264
IM-1111-001613
IM-1111-001630
IM-1111-001632
IM-2222-001825
IM-1111-001931
IM-1111-002029
IM-1111-002270
IM-3333-002387
;

run;

data want;
set have;
t=compress(id,' ','a');
id=ifc(length(t)&amp;gt;11,substr(t,2),t);
drop t;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 04 Jun 2018 15:24:17 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-06-04T15:24:17Z</dc:date>
    <item>
      <title>SUBSTR remove all letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTR-remove-all-letter/m-p/467440#M119318</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to remove the letters in the dataset below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Have;&lt;/P&gt;&lt;P&gt;input id;&lt;/P&gt;&lt;P&gt;1111-000001KK&lt;BR /&gt;1111-000002IM&lt;BR /&gt;1111-000003IM&lt;BR /&gt;1111-000011IM&lt;BR /&gt;1111-000111IM&lt;BR /&gt;1111-000221IM&lt;BR /&gt;1111-000331IM&lt;BR /&gt;1111-000441IM&lt;BR /&gt;1111-000002IM&lt;BR /&gt;IM-1111-000644&lt;BR /&gt;IM-1111-001264&lt;BR /&gt;IM-1111-001613&lt;BR /&gt;IM-1111-001630&lt;BR /&gt;IM-1111-001632&lt;BR /&gt;IM-2222-001825&lt;BR /&gt;IM-1111-001931&lt;BR /&gt;IM-1111-002029&lt;BR /&gt;IM-1111-002270&lt;BR /&gt;IM-3333-002387;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can anyone guide me as how to accomplish this task so the id variable has only numbers, as in Dataset Want?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Data want;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;1111-000001&lt;BR /&gt;1111-000002&lt;BR /&gt;1111-000003&lt;BR /&gt;1111-000011&lt;BR /&gt;1111-000111&lt;BR /&gt;1111-000221&lt;BR /&gt;1111-000331&lt;BR /&gt;1111-000441&lt;BR /&gt;1111-000002&lt;BR /&gt;1111-000644&lt;BR /&gt;1111-001264&lt;BR /&gt;1111-001613&lt;BR /&gt;1111-001630&lt;BR /&gt;1111-001632&lt;BR /&gt;2222-001825&lt;BR /&gt;1111-001931&lt;BR /&gt;1111-002029&lt;BR /&gt;1111-002270&lt;BR /&gt;3333-002387&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 15:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTR-remove-all-letter/m-p/467440#M119318</guid>
      <dc:creator>Rigler</dc:creator>
      <dc:date>2018-06-04T15:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: SUBSTR remove all letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTR-remove-all-letter/m-p/467442#M119319</link>
      <description>&lt;P&gt;Use the COMPRESS() function instead of SUBSTR.&lt;/P&gt;
&lt;P&gt;That will remove all the letters, but you'll have to check if you end up with a leading or trailing - that needs to be removed.&lt;/P&gt;
&lt;P&gt;You can use SUBSTR() for that, along with CHAR() to check the first/last character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x = compress(string, , 'a');
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;List of SAS functions are available here:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n01f5qrjoh9h4hn1olbdpb5pr2td.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n01f5qrjoh9h4hn1olbdpb5pr2td.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 15:23:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTR-remove-all-letter/m-p/467442#M119319</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-04T15:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: SUBSTR remove all letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTR-remove-all-letter/m-p/467443#M119320</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Have;

input id $20.;
cards;
1111-000001KK
1111-000002IM
1111-000003IM
1111-000011IM
1111-000111IM
1111-000221IM
1111-000331IM
1111-000441IM
1111-000002IM
IM-1111-000644
IM-1111-001264
IM-1111-001613
IM-1111-001630
IM-1111-001632
IM-2222-001825
IM-1111-001931
IM-1111-002029
IM-1111-002270
IM-3333-002387
;

run;

data want;
set have;
t=compress(id,' ','a');
id=ifc(length(t)&amp;gt;11,substr(t,2),t);
drop t;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Jun 2018 15:24:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTR-remove-all-letter/m-p/467443#M119320</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-06-04T15:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: SUBSTR remove all letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTR-remove-all-letter/m-p/467444#M119321</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is one solution&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Have;
input id $20.;
id=prxchange("s/-?[A-Z]-?//",-1,id);

cards;
1111-000001KK
1111-000002IM
1111-000003IM
1111-000011IM
1111-000111IM
1111-000221IM
1111-000331IM
1111-000441IM
1111-000002IM
IM-1111-000644
IM-1111-001264
IM-1111-001613
IM-1111-001630
IM-1111-001632
IM-2222-001825
IM-1111-001931
IM-1111-002029
IM-1111-002270
IM-3333-002387
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Jun 2018 15:30:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTR-remove-all-letter/m-p/467444#M119321</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-06-04T15:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: SUBSTR remove all letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTR-remove-all-letter/m-p/467455#M119323</link>
      <description>Great, This was perfect . Thank you!</description>
      <pubDate>Mon, 04 Jun 2018 16:09:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTR-remove-all-letter/m-p/467455#M119323</guid>
      <dc:creator>Rigler</dc:creator>
      <dc:date>2018-06-04T16:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: SUBSTR remove all letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTR-remove-all-letter/m-p/467456#M119324</link>
      <description>Another great answer! Thank you!</description>
      <pubDate>Mon, 04 Jun 2018 16:09:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTR-remove-all-letter/m-p/467456#M119324</guid>
      <dc:creator>Rigler</dc:creator>
      <dc:date>2018-06-04T16:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: SUBSTR remove all letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTR-remove-all-letter/m-p/467459#M119325</link>
      <description>This is equally a great solution. Thank you very much!</description>
      <pubDate>Mon, 04 Jun 2018 16:12:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTR-remove-all-letter/m-p/467459#M119325</guid>
      <dc:creator>Rigler</dc:creator>
      <dc:date>2018-06-04T16:12:12Z</dc:date>
    </item>
  </channel>
</rss>

