how can I create the sum of a variable as a new variable?

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

how can I create the sum of a variable as a new variable?

tino
how can I create the sum of a variable as a new variable (I need this "variable" for computing additional indices)?

To illustrate, assume there are n=5 cases for variable x, and variable x_sum should contain for each case the sum x:

Person    x      x_sum
1           2         8
2           2         8
3           3         8
4           1         8
5           0         8

Many thanks for your support!
Tino
Reply | Threaded
Open this post in threaded view
|

Re: how can I create the sum of a variable as a new variable?

Bruce Weaver
Administrator
Look up AGGREGATE, and see the examples.

tino wrote
how can I create the sum of a variable as a new variable (I need this "variable" for computing additional indices)?

To illustrate, assume there are n=5 cases for variable x, and variable x_sum should contain for each case the sum x:

Person    x      x_sum
1           2         8
2           2         8
3           3         8
4           1         8
5           0         8

Many thanks for your support!
Tino
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: how can I create the sum of a variable as a new variable?

Mario Giesel
Is it this what you want?

COMPUTE allcases = 1.
AGGREGATE
  /OUTFILE=* MODE=ADDVARIABLES
  /BREAK=allcases
  /x_sum=SUM(x).

Good luck,
  Mario


Bruce Weaver <[hidden email]> schrieb am 16:06 Montag, 4.November 2013:
Look up AGGREGATE, and see the examples.


tino wrote

> how can I create the sum of a variable as a new variable (I need this
> "variable" for computing additional indices)?
>
> To illustrate, assume there are n=5 cases for variable x, and variable
> x_sum should contain for each case the sum x:
>
> Person    x      x_sum
> 1          2        8
> 2          2        8
> 3          3        8
> 4          1        8
> 5          0        8
>
> Many thanks for your support!
> Tino





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/how-can-I-create-the-sum-of-a-variable-as-a-new-variable-tp5722875p5722877.html

Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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


Mario Giesel
Munich, Germany