sum as used in aggregate

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

sum as used in aggregate

mpirritano

SPSS IBMers!

 

If I use the sum function in aggregate are all values included. In other words, if there is a category that only has one value, is that included in the sum, or do I need to use sum.1 as I would in a regular compute statement to be sure that cases with only one value are included in the sum.

 

Thanks!

Matt

 

Matthew Pirritano, Ph.D.

Research Analyst IV

Medical Services Initiative (MSI)

Orange County Health Care Agency

(714) 568-5648

 

Reply | Threaded
Open this post in threaded view
|

Re: sum as used in aggregate

Ruben Geert van den Berg
Dear Matthew,
 
Do you mean a variable that contains only a single valid value? Can't you try with a small test data set what happens? It seems that sum.2 applies to within-case summation, not summation within a variable over cases. See
 
data list free /tinkywinky.
begin data
'' '' '' '' '' '' 1
end data.
comp dum=0.
agg
/out *
/bre dum
/lala=sum.2(tinkywinky).
exe.

HTH,
 
Ruben van den Berg


 



 

Date: Mon, 7 Dec 2009 09:43:39 -0800
From: [hidden email]
Subject: sum as used in aggregate
To: [hidden email]

SPSS IBMers!

 

If I use the sum function in aggregate are all values included. In other words, if there is a category that only has one value, is that included in the sum, or do I need to use sum.1 as I would in a regular compute statement to be sure that cases with only one value are included in the sum.

 

Thanks!

Matt

 

Matthew Pirritano, Ph.D.

Research Analyst IV

Medical Services Initiative (MSI)

Orange County Health Care Agency

(714) 568-5648

 



New Windows 7: Find the right PC for you. Learn more.
Reply | Threaded
Open this post in threaded view
|

Re: sum as used in aggregate

Richard Ristow
In reply to this post by mpirritano
At 12:43 PM 12/7/2009, Pirritano, Matthew wrote:

SPSS IBMers!

Hmmmph. It'll always be SPSS to me, no matter who buys it, or rebrands it.

If I use the sum function in aggregate are all values included. In other words, if there is a category that only has one value, is that included in the sum, or do I need to use sum.1 as I would in a regular compute statement to be sure that cases with only one value are included in the sum.

From the Command Syntax Reference:
 
By default, AGGREGATE uses all nonmissing values of the source variable to calculate aggregated variables. An aggregated variable will have a missing value only if the source variable is missing for every case in the break group.

You can alter the default missing-value treatment by using the MISSING subcommand.
.. MISSING must immediately follow OUTFILE .
.. COLUMNWISE is the only specification available for MISSING .
.. If COLUMNWISE is specified, the value of an aggregated variable is missing for a break group if the source variable is missing for any case in the group.

(Boldface emphasis added)

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

Re: sum as used in aggregate

mpirritano

Thanks Richard,

 

Not sure how I missed that.

 

Matthew Pirritano, Ph.D.

Research Analyst IV

Medical Services Initiative (MSI)

Orange County Health Care Agency

(714) 568-5648


From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Richard Ristow
Sent: Monday, December 07, 2009 12:16 PM
To: [hidden email]
Subject: Re: sum as used in aggregate

 

At 12:43 PM 12/7/2009, Pirritano, Matthew wrote:


SPSS IBMers!


Hmmmph. It'll always be SPSS to me, no matter who buys it, or rebrands it.


If I use the sum function in aggregate are all values included. In other words, if there is a category that only has one value, is that included in the sum, or do I need to use sum.1 as I would in a regular compute statement to be sure that cases with only one value are included in the sum.


From the Command Syntax Reference:
 

By default, AGGREGATE uses all nonmissing values of the source variable to calculate aggregated variables. An aggregated variable will have a missing value only if the source variable is missing for every case in the break group.

You can alter the default missing-value treatment by using the MISSING subcommand.
.. MISSING must immediately follow OUTFILE .
.. COLUMNWISE is the only specification available for MISSING .
.. If COLUMNWISE is specified, the value of an aggregated variable is missing for a break group if the source variable is missing for any case in the group.


(Boldface emphasis added)


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