Date: Thu, 3 Dec 1998 14:25:55 -0600
Reply-To: King Douglas <King_Douglas@AMRCORP.COM>
Sender: "SPSSX(r) Discussion" <SPSSX-L@UGA.CC.UGA.EDU>
From: King Douglas <King_Douglas@AMRCORP.COM>
Subject: Re: Global format change -Reply -Reply
More. . . TRUNC will simply drop the decimal places (-4.7 will be -4). Using
the same SYNTAX and the RND function will round the value to an integer (-4.7
will be -5). You can also format the variables within the DO REPEAT. . . END
DO REPEAT P = VAR1 VAR2 VAR3 VARLAST.
COMPUTE P = TRUNC(P). ** OR COMPUTE P = RND(P).**
FORMATS P (F8.0).
END REPEAT PRINT.
>>> King Douglas 12/03/98 02:15pm >>>
It's very simple (I'd back up my data set first, though). Use the DO REPEAT
transformation (which will save you a lot of typing) and the TRUNC function
(which truncates the value to an integer). The entire command will look
something like this:
DO REPEAT P = VAR1 VAR2 VAR3. . . VARLAST.
COMPUTE P = TRUNC(P).
END REPEAT PRINT.
On the first line of a new SYNTAX WINDOW, type "DO REPEAT P = " (I like to use
"P" but any letter will do). Next, paste the names of all the variables you
want to change. To do this, click on UTILITIES. . . VARIABLES and use the
PASTE BUTTON after you have selected the variables. After you return to the
SYNTAX WINDOW, put a period after the last variable name. Then just type the
commands shown above:
COMPUTE P = TRUNC(P). **Drop all decimal places from each variable, P**
END REPEAT PRINT. **Show me a list of all the transformations**
EXECUTE. **Do it now**
>>> Cheoleon Lee <Cheoleon_Lee@GALLUP.COM> 12/03/98 10:42am >>>
Dear fellow listservers,
I have several hundred variables which all have 2 digits below decimal
Is there any way I can get rid of the digits below decimal point and make
them whole numbers?
Thanks in advance.