<?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 Transform a charcter to a numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Transform-a-charcter-to-a-numeric/m-p/624497#M183984</link>
    <description>&lt;P&gt;If I have a character value called epspropl=45.5c and I convert it to a numeric by:&amp;nbsp;&lt;/P&gt;&lt;P&gt;vepspropl=input (epspropl,8.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is since it contains an alphabetic character c, is there a way to convert epspropl to a numeric and get rid of the unwanted c or do I have to do something else to get rid of the c?&lt;/P&gt;</description>
    <pubDate>Thu, 13 Feb 2020 15:28:16 GMT</pubDate>
    <dc:creator>jacksonan123</dc:creator>
    <dc:date>2020-02-13T15:28:16Z</dc:date>
    <item>
      <title>Transform a charcter to a numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-a-charcter-to-a-numeric/m-p/624497#M183984</link>
      <description>&lt;P&gt;If I have a character value called epspropl=45.5c and I convert it to a numeric by:&amp;nbsp;&lt;/P&gt;&lt;P&gt;vepspropl=input (epspropl,8.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is since it contains an alphabetic character c, is there a way to convert epspropl to a numeric and get rid of the unwanted c or do I have to do something else to get rid of the c?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 15:28:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-a-charcter-to-a-numeric/m-p/624497#M183984</guid>
      <dc:creator>jacksonan123</dc:creator>
      <dc:date>2020-02-13T15:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: Transform a charcter to a numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-a-charcter-to-a-numeric/m-p/624499#M183985</link>
      <description>&lt;P&gt;You could use the COMPRESS() function to get rid of all characters before you use the INPUT function. The 'a' modifier of the compress function eliminates characters but not numbers or decimals.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;vepspropl=input (compress(epspropl,,'a'),8.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Feb 2020 15:33:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-a-charcter-to-a-numeric/m-p/624499#M183985</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-02-13T15:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: Transform a charcter to a numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-a-charcter-to-a-numeric/m-p/624500#M183986</link>
      <description>&lt;P&gt;One way:&lt;/P&gt;
&lt;PRE&gt;data example;
   epspropl="45.5c"; 
   vepspropl=input (compress(epspropl,,'a'),8.);
run;&lt;/PRE&gt;
&lt;P&gt;compress removes characters from a string. In this case it removes all alphabetic. If you don't want that and only want a c removed&lt;/P&gt;
&lt;PRE&gt;data example;
   epspropl="45.5c"; 
   vepspropl=input (compress(epspropl,'c','i'),8.);
run;&lt;/PRE&gt;
&lt;P&gt;the 'i' says to ignore case when removing c, so would remove both upper and lower case c's.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 15:37:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-a-charcter-to-a-numeric/m-p/624500#M183986</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-02-13T15:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: Transform a charcter to a numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-a-charcter-to-a-numeric/m-p/624502#M183987</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input a $2. b $3. c $3.;
	datalines;
1a 2b 3c
	;
run;

data want;
	set have;
	test = input(compress(a, '', 'a'), 2.);
run;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Feb 2020 15:41:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-a-charcter-to-a-numeric/m-p/624502#M183987</guid>
      <dc:creator>Krueger</dc:creator>
      <dc:date>2020-02-13T15:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Transform a charcter to a numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-a-charcter-to-a-numeric/m-p/624504#M183988</link>
      <description>&lt;P&gt;You have to do something to tell INPUT() not to read the letter.&lt;/P&gt;
&lt;P&gt;So you could remove the C from the string using say COMPRESS().&amp;nbsp; &amp;nbsp;Like compress(&lt;SPAN&gt;epspropl,'c').&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;If it is just the last character you could use SUBSTR() or the informat.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Like substr(&lt;SPAN&gt;epspropl,1,length(epspropl)-1).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; Or just tell it to only use the first 4 characters.&amp;nbsp; Like: input(epspropl,4.)&amp;nbsp; or INPUTN(epspropl,cats(length(epspropl)-1,'.'))&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 15:47:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-a-charcter-to-a-numeric/m-p/624504#M183988</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-13T15:47:29Z</dc:date>
    </item>
  </channel>
</rss>

