<?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: Convert Character to Numeric then Character again in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-Character-to-Numeric-then-Character-again/m-p/442308#M28543</link>
    <description>&lt;P&gt;Pleasenote, what I provided was an&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;example&lt;/STRONG&gt;&lt;/U&gt; to show the logic.&amp;nbsp; You would of course pass in the dataset which you have (and I don't!) using a set statement.&lt;/P&gt;
&lt;PRE&gt;data want;
  set yourdata;
  account_id=substr(account_id,findc(account_id,"123456789"));
run;&lt;/PRE&gt;
&lt;P&gt;Replace the word yourdata with the dataset name.&lt;/P&gt;</description>
    <pubDate>Mon, 05 Mar 2018 11:38:59 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-03-05T11:38:59Z</dc:date>
    <item>
      <title>Convert Character to Numeric then Character again</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-Character-to-Numeric-then-Character-again/m-p/442294#M28539</link>
      <description>&lt;P&gt;Dear community friends,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having problem in converting a character to numeric and back to character again&lt;/P&gt;&lt;P&gt;The idea is to get only the numbers without the "0" in the beginning&lt;/P&gt;&lt;P&gt;For example, the number is 0012345678901230042 and I want to the new field to result as 12345678901230042&lt;/P&gt;&lt;P&gt;I tried using the following syntax:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LEFT(PUT(input(Account_ID,BEST19.0),19.)) end as MainAccountID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result is 12345678901230040 with Character format&lt;/P&gt;&lt;P&gt;Seems the last number is being rounded down by the system&lt;/P&gt;&lt;P&gt;Really appreciate if anyone can give some help&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 10:26:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-Character-to-Numeric-then-Character-again/m-p/442294#M28539</guid>
      <dc:creator>andyoey</dc:creator>
      <dc:date>2018-03-05T10:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Character to Numeric then Character again</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-Character-to-Numeric-then-Character-again/m-p/442295#M28540</link>
      <description>&lt;P&gt;SAS has a limit to the number of digits in long numbers.&amp;nbsp; I can remember off the top of my head, but I believe it is 16.&amp;nbsp; Anyways, if you just want to remove the preceding 0's:&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;data want;&lt;BR /&gt; account_id="0012345678901230042";&lt;BR /&gt; account_id=substr(account_id,findc(account_id,"123456789"));&lt;BR /&gt;run;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Mar 2018 10:33:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-Character-to-Numeric-then-Character-again/m-p/442295#M28540</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-03-05T10:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Character to Numeric then Character again</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-Character-to-Numeric-then-Character-again/m-p/442297#M28541</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for the feedback&lt;/P&gt;&lt;P&gt;Unfortunately the solution can only affect 1 sample, while there are more than 1000 data with different numbers with the one from my example, such as&lt;/P&gt;&lt;P&gt;00134578919018018&lt;/P&gt;&lt;P&gt;00245819124782933&lt;/P&gt;&lt;P&gt;00011238194719972&lt;/P&gt;&lt;P&gt;I won't be able to specify all the numbers to only exclude the 0 from the begining&lt;/P&gt;&lt;P&gt;Also, I tried your solution and it still take the first "00"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 10:41:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-Character-to-Numeric-then-Character-again/m-p/442297#M28541</guid>
      <dc:creator>andyoey</dc:creator>
      <dc:date>2018-03-05T10:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Character to Numeric then Character again</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-Character-to-Numeric-then-Character-again/m-p/442307#M28542</link>
      <description>&lt;P&gt;Storing an accountID as numeric does not make sense in SAS, as the maximum reliable precision of numeric data in datasets is 15 decimal digits, so you will lose information.&lt;/P&gt;
&lt;P&gt;Store IDs in character variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;'s solution will work for all your values, see&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input account_id $20.;
cards;
00134578919018018
00245819124782933
00011238194719972
;
run;

data want;
set have;
account_id=substr(account_id,findc(account_id,"123456789"));
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;  account_id

134578919018018
245819124782933
11238194719972 
&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Mar 2018 11:36:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-Character-to-Numeric-then-Character-again/m-p/442307#M28542</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-05T11:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Character to Numeric then Character again</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-Character-to-Numeric-then-Character-again/m-p/442308#M28543</link>
      <description>&lt;P&gt;Pleasenote, what I provided was an&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;example&lt;/STRONG&gt;&lt;/U&gt; to show the logic.&amp;nbsp; You would of course pass in the dataset which you have (and I don't!) using a set statement.&lt;/P&gt;
&lt;PRE&gt;data want;
  set yourdata;
  account_id=substr(account_id,findc(account_id,"123456789"));
run;&lt;/PRE&gt;
&lt;P&gt;Replace the word yourdata with the dataset name.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 11:38:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-Character-to-Numeric-then-Character-again/m-p/442308#M28543</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-03-05T11:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Character to Numeric then Character again</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-Character-to-Numeric-then-Character-again/m-p/442326#M28545</link>
      <description>&lt;P&gt;Here are two another ways.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input account_id $20.;
cards;
00134578919018018
00245819124782933
00011238194719972
;
run;

data want;
set have;
way1=substr(account_id,verify(account_id,"0"));
way2=prxchange('s/^0+//',-1,strip(account_id));
run;

proc print noobs;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Mar 2018 12:40:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-Character-to-Numeric-then-Character-again/m-p/442326#M28545</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-03-05T12:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Character to Numeric then Character again</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-Character-to-Numeric-then-Character-again/m-p/442721#M28562</link>
      <description>&lt;P&gt;Thanks, finally it's working&lt;/P&gt;&lt;P&gt;Was not working yesterday since I combined it with another syntax which cause the error&lt;/P&gt;&lt;P&gt;Really appreciate your help&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 03:17:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-Character-to-Numeric-then-Character-again/m-p/442721#M28562</guid>
      <dc:creator>andyoey</dc:creator>
      <dc:date>2018-03-06T03:17:39Z</dc:date>
    </item>
  </channel>
</rss>

