sum groups of variables

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

sum groups of variables

parisec
 
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
 
 
 
 
Reply | Threaded
Open this post in threaded view
|

Re: sum groups of variables

Poes, Matthew Joseph

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.
Sent: Friday, May 25, 2012 1:12 PM
To: [hidden email]
Subject: sum groups of variables

 

 

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

 

 

 

 

Reply | Threaded
Open this post in threaded view
|

Re: sum groups of variables

parisec
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.
Sent: Friday, May 25, 2012 1:12 PM
To: [hidden email]
Subject: sum groups of variables

 

 

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

 

 

 

 

Reply | Threaded
Open this post in threaded view
|

Re: sum groups of variables

David Marso
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).


parisec wrote
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]<mailto:[hidden email]>


From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Parise, Carol A.
Sent: Friday, May 25, 2012 1:12 PM
To: [hidden email]
Subject: sum groups of variables


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
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?"