<?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 remove numbers from charater variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/364289#M86381</link>
    <description>&lt;P&gt;There are several ways to remove the numbers:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data state;
input ID $;
/*1*/ id = translate(id,'','0123456789');
/*2*/ id = compress(id,'0123456789');&lt;BR /&gt;/*3*/ id = compress(id,' ','D');
cards;
... your data ...
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 05 Jun 2017 15:09:19 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2017-06-05T15:09:19Z</dc:date>
    <item>
      <title>How to remove numbers from charater variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/364286#M86379</link>
      <description>&lt;P&gt;Hello, all:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to remove the last number from the ID column.&amp;nbsp; I have 300 ID names which need to do this repeatly.&amp;nbsp; Please let me know how, thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; state;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ID $;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;cards&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;TN1&lt;/P&gt;&lt;P&gt;TN2&lt;/P&gt;&lt;P&gt;TN3&lt;/P&gt;&lt;P&gt;UCH1&lt;/P&gt;&lt;P&gt;UCH2&lt;/P&gt;&lt;P&gt;UCH3&lt;/P&gt;&lt;P&gt;UCH4&lt;/P&gt;&lt;P&gt;UCH5&lt;/P&gt;&lt;P&gt;ICFG1&lt;/P&gt;&lt;P&gt;ICFG2&lt;/P&gt;&lt;P&gt;ICFG3&lt;/P&gt;&lt;P&gt;ICFG4&lt;/P&gt;&lt;P&gt;ICFG5&lt;/P&gt;&lt;P&gt;ICFG6&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 14:56:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/364286#M86379</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-06-05T14:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove numbers from charater variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/364289#M86381</link>
      <description>&lt;P&gt;There are several ways to remove the numbers:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data state;
input ID $;
/*1*/ id = translate(id,'','0123456789');
/*2*/ id = compress(id,'0123456789');&lt;BR /&gt;/*3*/ id = compress(id,' ','D');
cards;
... your data ...
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Jun 2017 15:09:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/364289#M86381</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-06-05T15:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove numbers from charater variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/364290#M86382</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data state;
input ID $;
new=prxchange('s/\d$/ /',-1,strip(id));
cards;
TN1
TN2
TN3
UCH1
UCH2
UCH3
UCH4
UCH5
ICFG1
ICFG2
ICFG3
ICFG4
ICFG5
ICFG6
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Jun 2017 15:20:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/364290#M86382</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-06-05T15:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove numbers from charater variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/364291#M86383</link>
      <description>&lt;P&gt;You could also do:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;id&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;compress&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token keyword"&gt;id&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,,'ka'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;K=Keep, A=Alpha.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000212246.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000212246.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Might be a bit shorted if you had other things as there are a few options in compress.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 15:09:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/364291#M86383</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-05T15:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove numbers from charater variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/364292#M86384</link>
      <description>&lt;P&gt;If you only want to remove one digit if it exists at the end of an id you could use:&lt;/P&gt;
&lt;PRE&gt;data want;
  set state;
  if findc(id,,'db') then id=substr(id,1,findc(id,,'db')-1);
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 15:13:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/364292#M86384</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-06-05T15:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove numbers from charater variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/364295#M86386</link>
      <description>&lt;P&gt;What is the 'db' refering?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 15:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/364295#M86386</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-06-05T15:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove numbers from charater variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/364296#M86387</link>
      <description>&lt;P&gt;find a digit, searching from right to left. And, as I think about it, the code I suggested should actually have been:&lt;/P&gt;
&lt;PRE&gt;data want;
  set state;
  if findc(id,,'db') eq length(id) then id=substr(id,1,findc(id,,'db')-1);
run;
&lt;/PRE&gt;
&lt;P&gt;i.e., only remove the last character .. if it is a digit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 15:28:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/364296#M86387</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-06-05T15:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove numbers from charater variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/364355#M86416</link>
      <description>&lt;P&gt;Thanks for your kind help.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 19:43:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/364355#M86416</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-06-05T19:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove numbers from charater variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/468472#M119659</link>
      <description>&lt;P&gt;HI Art,&lt;/P&gt;
&lt;P&gt;could you please let me know how to remove entries with at least one number (any number) of a character variable?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 17:51:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/468472#M119659</guid>
      <dc:creator>lalohg</dc:creator>
      <dc:date>2018-06-07T17:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove numbers from charater variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/468473#M119660</link>
      <description>&lt;P&gt;HI Art,&lt;/P&gt;
&lt;P&gt;could you please let me know how to remove entries with at least one number (any number) of a character variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Lalo&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 17:52:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/468473#M119660</guid>
      <dc:creator>lalohg</dc:creator>
      <dc:date>2018-06-07T17:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove numbers from charater variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/468498#M119672</link>
      <description>&lt;P&gt;Just use the anydigit function. i.e.,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if anydigit(varname) then call missing(varname);&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>Thu, 07 Jun 2018 19:20:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/468498#M119672</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-06-07T19:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove numbers from charater variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/468653#M119742</link>
      <description>&lt;P&gt;Thank you very much&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a good day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lalo.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2018 11:52:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-numbers-from-charater-variable/m-p/468653#M119742</guid>
      <dc:creator>lalohg</dc:creator>
      <dc:date>2018-06-08T11:52:36Z</dc:date>
    </item>
  </channel>
</rss>

