Date: Thu, 7 Sep 2006 20:11:13 -0400
Reply-To: Lou <lpogodajr292185@COMCAST.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Lou <lpogodajr292185@COMCAST.NET>
Subject: Re: How do I convert this character to number
10000000000000000001?
You don't. According to the online docs, the largest integer represented
exactly is 2^53, or 9,007,199,254,740,992 - you've exceeded that number by
some four orders of magnitude.
The above applies to Windows and the limits can be different for different
operating systems - on CMS for example, the highest exact integer is
2,147,483,647. Consult the Companion for whatever operating system you're
using.
"join" <jtsas999@yahoo.co.uk> wrote in message
news:1157656947.810984.49690@h48g2000cwc.googlegroups.com...
> If I use the normal route it drops the last digit = 100000000000000000
>
> The current database uses two keys of these values. Using numerics
> would enable me to count and use other statistic routines on these
> keys.
>
> am using v9.1
>
> Also tried this:
>
> * convert keys to numeric;
> data _null_;
> customer_ID_char='1000000000000000035';
>
> length first_cust_Char second_cust_Char $12;
>
> first_cust_Char = substr(customer_ID_Char,1,10);
> second_cust_Char = substr(customer_ID_Char,11);
>
> first_cust_num=input(first_cust_Char,best10.)*100000000;
> second_cust_num=input(second_cust_Char,best10.);
>
> customer_ID=first_cust_num+second_cust_num;
>
> put "customer_ID_Char" @20 customer_ID_Char;
> put "first_cust_Char" @20 first_cust_Char;
> put "second_cust_Char" @20 second_cust_Char;
> put "first_cust_num" @20 first_cust_num f20.;
> put "second_cust_num" @20 second_cust_num f20.;
> put "customer_ID" @20 customer_ID f20.;
> run;
>
>
> LOG:
> ----------------------------------------------------
> 809 * convert keys to numeric;
> 810 data _null_;
> 811 customer_ID_char='1000000000000000035';
> 812
> 813 length first_cust_Char second_cust_Char $12;
> 814
> 815 first_cust_Char = substr(customer_ID_Char,1,10);
> 816 second_cust_Char = substr(customer_ID_Char,11);
> 817
> 818 first_cust_num=input(first_cust_Char,best10.)*100000000;
> 819 second_cust_num=input(second_cust_Char,best10.);
> 820
> 821 customer_ID=first_cust_num+second_cust_num;
> 822
> 823 put "customer_ID_Char" @20 customer_ID_Char;
> 824 put "first_cust_Char" @20 first_cust_Char;
> 825 put "second_cust_Char" @20 second_cust_Char;
> 826 put "first_cust_num" @20 first_cust_num f20.;
> 827 put "second_cust_num" @20 second_cust_num f20.;
> 828 put "customer_ID" @20 customer_ID f20.;
> 829 run;
>
> customer_ID_Char 1000000000000000035
> first_cust_Char 1000000000
> second_cust_Char 000000035
> first_cust_num 100000000000000000
> second_cust_num 35
> customer_ID 100000000000000032
> NOTE: DATA statement used (Total process time):
> real time 0.00 seconds
> cpu time 0.00 seconds
>
|