Label to 22-digit id

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Label to 22-digit id

Andi-23
HI everybody,

I thought that I would have a simple problem but I could not solve it.
I have a 22-digits ID like "1010010070001500012312" and would like to give a
label to this ID like ("Andi").

var lab
/id
1010010070001500012312 "Andi".

However, when I try to do this then SPSS somehow cuts the ID at a position
and  enters 0 after that. The results is as follows.

freq id.

1010010070001500000000 Andi

Can anybody please help with this problem, please?

Bye
Andi

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Label to 22-digit id

Art Kendall
  a string of characters that long cannot be held  precisely as a 64 bit
floating point number. the max is about 16 or  17 decimal places.
aside: I am curious as to why you need such a long field to get a unique
identifier.  There are 6 or 7 billion people on earth.  s unique
identifier would only require 10 digits.

One workaround would be to use it as a string.
Another work around is to autorecode into a new variable and then recode
that variable.
This would avoid having to type 22 digit numbers accurately.

Also, recently there was a Python approach posted to apply the the
contents of one variable as the value labels of another.

open a new instance of SPSS.  Cut, paste, and run this syntax.  to see
the difference in how strings and number work.

new file.
data list list/id (a22).
begin data
1010010070001500012312
1234567890123456789012
end data.
execute.
var labels id "ID for case".
value labels id
"1010010070001500012312" "Andi"
"1234567890123456789012" "digits".
string vlab(a6).
compute vlab = valuelabel(id).
display dictionary.
list.


new file.
data list list/id (f22).
begin data
1010010070001500012312
1234567890123456789012
end data.
execute.
var labels id "ID for case".
value labels id
1010010070001500012312 "Andi"
1234567890123456789012 "digits".
string vlab(a6).
compute vlab = valuelabel(id).
display dictionary.
list.

Art Kendall
Social Research Consultants


Andi wrote:

> HI everybody,
>
> I thought that I would have a simple problem but I could not solve it.
> I have a 22-digits ID like "1010010070001500012312" and would like to give a
> label to this ID like ("Andi").
>
> var lab
> /id
> 1010010070001500012312 "Andi".
>
> However, when I try to do this then SPSS somehow cuts the ID at a position
> and  enters 0 after that. The results is as follows.
>
> freq id.
>
> 1010010070001500000000 Andi
>
> Can anybody please help with this problem, please?
>
> Bye
> Andi
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Label to 22-digit id

Richard Ristow
In reply to this post by Andi-23
At 03:09 AM 6/14/2008, Andi wrote:

>I thought that I would have a simple problem but I could not solve it.
>I have a 22-digits ID like "1010010070001500012312" and would like
>to give a label to this ID like ("Andi").
>
>var lab
>/id
>1010010070001500012312 "Andi".
>
>However, when I try to do this then SPSS somehow cuts the ID at a
>position and  enters 0 after that. The results is as follows.
>
>freq id.
>1010010070001500000000 Andi

You're running into the limits of SPSS numbers(*): Integers longer
than 15 digits may be truncated, and those longer than 16 digits
always will be.

You can make your ID a string of length 22. In SPSS 16, but not
earlier, you can assign value labels to a 22-character string (or to
any string longer than 8 characters).
.........................
(*) If you're interested:

SPSS, and most current applications, represent numbers in the 64-bit
floating-point format defined by IEEE standard 754. Most modern
computers have hardware to do arithmetic with IEEE 754 numbers, so
calculations are fast and easy to program.

Precision is 53 bits, which is very close to 16 decimal digits. All
integers from 0 through 9,007,199,254,740,992 (i.e., all through 15
digits, and most through 16 digits) can be represented, as can
numbers as between about 10**-308 and 10**308.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD