<?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 separate out character and numeric from one column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-separate-out-character-and-numeric-from-one-column/m-p/710685#M273896</link>
    <description>&lt;P&gt;Kurt, your code works fine for digits 0-9. But how about decimals? How would you get the decimal numbers from that same mixed variables also converted to numbers?&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jan 2021 21:43:08 GMT</pubDate>
    <dc:creator>AlpanaHansaria</dc:creator>
    <dc:date>2021-01-11T21:43:08Z</dc:date>
    <item>
      <title>How to separate out character and numeric from one column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-separate-out-character-and-numeric-from-one-column/m-p/353600#M273890</link>
      <description>&lt;P&gt;&amp;nbsp;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have one column in that character as well as numeric values are there i need to seperate out those value on base of &amp;nbsp;character and numeric. there is no specific value that we need to seperate out like&lt;/P&gt;&lt;P&gt;ACNB&lt;/P&gt;&lt;P&gt;1980&lt;/P&gt;&lt;P&gt;asjl&lt;/P&gt;&lt;P&gt;8909&lt;/P&gt;&lt;P&gt;8012&lt;/P&gt;&lt;P&gt;dsufjs&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like that i have one column want to seperate the character and numeric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Prashant.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 10:19:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-separate-out-character-and-numeric-from-one-column/m-p/353600#M273890</guid>
      <dc:creator>sas_pkc1</dc:creator>
      <dc:date>2017-04-26T10:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to separate out character and numeric from one column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-separate-out-character-and-numeric-from-one-column/m-p/353601#M273891</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if notdigit(strip(acnb)) &amp;gt; 0
then acnb_char = acnb;
else acnb_num = input(acnb,best.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;notdigit() scans for characters outside 0-9, strip() removes any blanks before notdigit() scans.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 10:33:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-separate-out-character-and-numeric-from-one-column/m-p/353601#M273891</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-04-26T10:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to separate out character and numeric from one column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-separate-out-character-and-numeric-from-one-column/m-p/353602#M273892</link>
      <description>&lt;P&gt;Would it not be safer t keep both, for instance in CDISC models you have a character result - which has everything in as its recorded - and also a numeric result where possible. &amp;nbsp;That way you have best of both worlds, a variable to report as it was, and a numeric to do calculations on? &amp;nbsp;As for how to do that:&lt;/P&gt;
&lt;PRE&gt;new_col=input(old_col,best.);&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Apr 2017 10:39:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-separate-out-character-and-numeric-from-one-column/m-p/353602#M273892</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-04-26T10:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to separate out character and numeric from one column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-separate-out-character-and-numeric-from-one-column/m-p/353615#M273893</link>
      <description>&lt;P&gt;&amp;nbsp;The rules for "character" or "numeric" are more complex since a legitimate number can contain a decimal point or a negative sign, but cannot contain embedded blanks. &amp;nbsp;(We'll leave commas out of the mix here.) &amp;nbsp;A robust way would be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if acnb&amp;nbsp;&amp;gt; ' ' and input(acnb, ??16.) = . &amp;nbsp;then acnb_character=acnb;&lt;/P&gt;
&lt;P&gt;else acnb_numeric = input(acnb, 16.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are allowed to use a shorter informat, one that matches the length of your variable.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 11:09:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-separate-out-character-and-numeric-from-one-column/m-p/353615#M273893</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-04-26T11:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to separate out character and numeric from one column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-separate-out-character-and-numeric-from-one-column/m-p/353659#M273894</link>
      <description>&lt;P&gt;Thanks for idea.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the column ACNB is the character column and number and character are there.&lt;/P&gt;&lt;P&gt;so in strip if my value is 0001 then in final table its coming as 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;that is the problem.&lt;/P&gt;&lt;P&gt;Please suggest if any&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 12:25:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-separate-out-character-and-numeric-from-one-column/m-p/353659#M273894</guid>
      <dc:creator>sas_pkc1</dc:creator>
      <dc:date>2017-04-26T12:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to separate out character and numeric from one column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-separate-out-character-and-numeric-from-one-column/m-p/353667#M273895</link>
      <description>&lt;P&gt;That output is correct, if you take the string 0001 and set this as a numeric value, then number is 1. &amp;nbsp;there is no such thing as a numeric with preceding zeros. &amp;nbsp;You can apply a format - zX. where X is the number of elements - but what this is doing is displaying the underlying number 1 as 0001, doesen't change the value, and you would need to apply that format to the whole column.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 12:45:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-separate-out-character-and-numeric-from-one-column/m-p/353667#M273895</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-04-26T12:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to separate out character and numeric from one column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-separate-out-character-and-numeric-from-one-column/m-p/710685#M273896</link>
      <description>&lt;P&gt;Kurt, your code works fine for digits 0-9. But how about decimals? How would you get the decimal numbers from that same mixed variables also converted to numbers?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2021 21:43:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-separate-out-character-and-numeric-from-one-column/m-p/710685#M273896</guid>
      <dc:creator>AlpanaHansaria</dc:creator>
      <dc:date>2021-01-11T21:43:08Z</dc:date>
    </item>
  </channel>
</rss>

