Hi all
I can't believe i haven't run into this before.
I want to compute the sum of : A1 to A5; B1 to B5; C1 to C5.
The file is laid out:
A1 A2 A3 A4....A20 B1 B2 B3...B20 etc
I've tried the following versions of compute:
COMPUTE numDX = sum(A1 to A5; B1 to B5; C1 to C5)
WRONG!
COMPUTE numDX = sum(A1 to A5)+ (B1 to B5) +(C1 to C5)
WRONG!
COMPUTE numDX = sum(A1 to A5, B1 to B5, C1 to C5)
WRONG again!
COMPUTE numDX = sum(A1 to A5 B1 to B5 C1 to C5)
and still wrong!
what rendition of this am i missing that is the correct one?
thanks much
Carol
|
I believe you would need to either do
Sum(A1 to C##) Or if you need it spaced Sum(A1 to A5) + sum(B1 to B5), etc. Matthew J Poes Research Data Specialist Center for Prevention Research and Development University of Illinois 510 Devonshire Dr. Champaign, IL 61820 Phone: 217-265-4576 email:
[hidden email] From: SPSSX(r) Discussion [mailto:[hidden email]]
On Behalf Of Parise, Carol A. Hi all I can't believe i haven't run into this before.
I want to compute the sum of : A1 to A5; B1 to B5; C1 to C5. The file is laid out: A1 A2 A3 A4....A20 B1 B2 B3...B20 etc I've tried the following versions of compute: COMPUTE numDX = sum(A1 to A5; B1 to B5; C1 to C5)
WRONG! COMPUTE numDX = sum(A1 to A5)+ (B1 to B5) +(C1 to C5)
WRONG! COMPUTE numDX = sum(A1 to A5, B1 to B5, C1 to C5) WRONG again! COMPUTE numDX = sum(A1 to A5 B1 to B5 C1 to C5) and still wrong! what rendition of this am i missing that is the correct one? thanks much Carol |
ding! ding! ding!
Sum(A1
to A5) + sum(B1 to B5), etc. we have a winner.
thanks much
From: Poes, Matthew Joseph [mailto:[hidden email]] Sent: Friday, May 25, 2012 11:15 AM To: Parise, Carol A.; '[hidden email]' Subject: RE: sum groups of variables I
believe you would need to either do Sum(A1
to C##) Or
if you need it spaced Sum(A1
to A5) + sum(B1 to B5), etc. Matthew
J Poes Research
Data Specialist Center
for Prevention Research and Development University
of Illinois 510
Devonshire Dr. Champaign,
IL 61820 Phone: 217-265-4576 email:
[hidden email] From: SPSSX(r) Discussion
[mailto:[hidden email]] On Behalf Of Parise, Carol
A. Hi all I can't believe i
haven't run into this before. I want to compute the
sum of : A1 to A5; B1 to B5; C1 to C5. The file is laid
out: A1 A2 A3 A4....A20 B1
B2 B3...B20 etc I've tried the
following versions of compute: COMPUTE numDX =
sum(A1 to A5; B1 to B5; C1 to C5) WRONG! COMPUTE numDX =
sum(A1 to A5)+ (B1 to B5) +(C1 to C5) WRONG! COMPUTE numDX =
sum(A1 to A5, B1 to B5, C1 to C5) WRONG
again! COMPUTE numDX =
sum(A1 to A5 B1 to B5 C1 to C5) and still
wrong! what rendition of
this am i missing that is the correct one? thanks
much Carol |
Administrator
|
If for some reason any of the constituent sums are all missing your ding ding will go thud thud or boom boom.
One of your previous possibilities actually works just fine. compute sx1=sum(a1 to a5,b1 to b5,c1 to c5).
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Free forum by Nabble | Edit this page |