Date: Fri, 27 Jun 2008 17:10:09 +0100
Reply-To: J Sutar <jsutar@gmail.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: J Sutar <jsutar@gmail.com>
Subject: Converting long strings
Content-Type: text/plain; charset=ISO-8859-1
Why does the following syntax only pick up the first 16 character of the
string variable when attempting to convert it to a numeric?
NEW FILE.
DATA LIST LIST/ v1(A25).
BEGIN DATA.
1
12
123
1234
12345
123456
1234567
12345678
123456789
1234567890
12345678901
123456789012
1234567890123
12345678901234
123456789012345
1234567890123456
12345678901234567
123456789012345678
1234567890123456789
12345678901234567890
123456789012345678921
1234567890123456789212
END DATA.
STRING newvar(A99).
COMPUTE newvar=LTRIM(RTRIM(v1)).
COMPUTE newvar2 =NUMBER (newvar, F36.0).
EXE.
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (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
|