Absolute value

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

Absolute value

Anthony James
Dear colleagues,
I want to get the absolute value of a variable in SPSS. That is, I want to get read of the negative sing next to some values  and compute the mean of the values. I want to change all the negative values to positive.
What should I do?
Thanks
Anthony
Reply | Threaded
Open this post in threaded view
|

Re: Absolute value

ariel barak
Hi Anthony,

You want to use the absolute function ABS(variable). I searched the archives and here is a post from Art Kendall that has the solution.

Hope this helps,
Ariel

http://listserv.uga.edu/cgi-bin/wa?A2=ind0812&L=spssx-l&P=R28075

*************************************************************************
open a clean instance of SPSS.
Copy the syntax below and paste it into a syntax window.

click <run> <all>.
If this is not what you want please explain in more detail, perhaps
making up a set of data with 2 columns: what you have and what you want.


data list list /myvar (comma8.2).
begin data
2,155.00
2,155.00
1,080.00
1,830.00
1,030.00
2,155.00
1,130.00
-2,155.00
-2,155.00
-1,080.00
-1,830.00
-1,030.00
-2,155.00
-1,130.00
end data.
compute myabsvar= abs(myvar).
LIST .


Art Kendall
Social Research Consultants
*************************************************************************



On Sat, Jun 16, 2012 at 12:26 AM, Anthony James <[hidden email]> wrote:
>
> Dear colleagues,
> I want to get the absolute value of a variable in SPSS. That is, I want to get read of the negative sing next to some values  and compute the mean of the values. I want to change all the negative values to positive.
> What should I do?
> Thanks
> Anthony

Reply | Threaded
Open this post in threaded view
|

Re: Absolute value

statisticsdoc
In reply to this post by Anthony James

 

Compute new_var = ABS(old_var)  .

 

Where new_var is the absolute value of old_var

 

www.StatisticsDoc.com

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Anthony James
Sent: Saturday, June 16, 2012 1:27 AM
To: [hidden email]
Subject: Absolute value

 

Dear colleagues,

I want to get the absolute value of a variable in SPSS. That is, I want to get read of the negative sing next to some values  and compute the mean of the values. I want to change all the negative values to positive.

What should I do?

Thanks

Anthony