Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to square a variable in SPSS 19

17,047 views
Skip to first unread message

L Rapeli

unread,
Jun 27, 2011, 2:26:42 AM6/27/11
to
Hi

Does anyone know an easy way to square a variable in spss 19, that is,
to create a new variable by multiplying the values of a variable by
itself?

Thanks!!

Rich Ulrich

unread,
Jun 27, 2011, 7:59:45 PM6/27/11
to
On Sun, 26 Jun 2011 23:26:42 -0700 (PDT), L Rapeli <lau...@utu.fi>
wrote:

COMPUTE is the SPSS keyword,
COMPUTE new= old*old.

See your SPSS on-disk documentation to get started.

For some wider issues, UCLA has a very helpful website.

--
Rich Ulrich

Bruce Weaver

unread,
Jun 29, 2011, 3:07:06 PM6/29/11
to


compute x_squared = x**2 .
compute x_cubed = x**3 .
compute sqrt_x = x**0.5 .
compute cuberoot_x = x**(1/3) .

HTH.

--
Bruce Weaver
bwe...@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/Home
"When all else fails, RTFM."

Allen

unread,
Jun 29, 2011, 3:19:27 PM6/29/11
to

I take that it isn't as simple as - compute test=var1**2?

Allen

unread,
Jun 29, 2011, 3:22:51 PM6/29/11
to
On Jun 27, 2:26 am, L Rapeli <lau...@utu.fi> wrote:

Isn't it as simple as - compute test=var1**2 ?

Bruce Weaver

unread,
Jun 29, 2011, 4:53:27 PM6/29/11
to
On Jun 27, 2:26 am, L Rapeli <lau...@utu.fi> wrote:

I replied a few hours ago (via the NEW Google Groups interface), but
still have not seen that response. So here goes again, this time from
the OLD Google Groups interface. Apologies if it ends up appearing
twice.

Jon

unread,
Jun 29, 2011, 10:37:13 PM6/29/11
to

compute vsq=v*v.
or
compute vsq=v**2.

jon

Ki

unread,
Jun 30, 2011, 1:13:42 PM6/30/11
to

You may use the arithmetic operator:
** Exponentiation

Something like this:
COMPUTE New_VAR=VAR**2.
Your variable is "VAR" and the operator is creating a new variable
"New_VAR".


KI

Allen

unread,
Jun 30, 2011, 1:24:55 PM6/30/11
to
On Jun 27, 2:26 am, L Rapeli <lau...@utu.fi> wrote:

I'd guess it "ain't' different than prior versions - compute
Test=var1**2.

0 new messages