addition problem

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

addition problem

Gary Stevens-2
I want to find the highest value in one column and add it to the highest
value in another column.
In the example below, by gender, I want to find the 90.77 in F_sum in
females (which happens to be BNH)
and the 83.35 in M_sum (WNH) and achieve the sum of 174.12.  Different
causes below heart will have different groupings.
Since I will never know the sum values, I can't figure out how to grab the
highest values in various causes, counties and years.
Thanks for any direction.

Cause           Ages   Gender  Raceethn County  F_sum  M_sum
Heart           0-14 F       BNH     Mon     90.77 83.22
Heart           15-24 F       BNH     Mon     90.77 83.22
Heart           25-44 F       BNH     Mon     90.77 83.22
Heart           45-64 F       BNH     Mon     90.77 83.22
Heart           65-74 F       BNH     Mon     90.77 83.22
Heart           75+ F       BNH     Mon     90.77 83.22
Heart           45-64 F       Hisp Mon     89.38 83.22
Heart           65-74 F       Hisp Mon     89.38 83.22
Heart           75+ F       Hisp Mon     89.38 83.22
Heart           25-44 F       WNH     Mon     90.33 83.35
Heart           45-64 F       WNH     Mon     90.33 83.35
Heart           65-74 F       WNH     Mon     90.33 83.35
Heart           75+ F       WNH     Mon     90.33 83.35
Heart           25-44 M       BNH     Mon     90.77 83.22
Heart           45-64 M       BNH     Mon     90.77 83.22
Heart           65-74 M       BNH     Mon     90.77 83.22
Heart           75'     M       BNH     Mon     90.77 83.22
Heart           25-44 M       Hisp Mon     89.38 83.22
Heart           45-64 M       Hisp Mon     89.38 83.22
Heart           65-74 M       Hisp Mon     89.38 83.22
Heart           75+ M       Hisp Mon     89.38 83.22
Heart           15-24 M       WNH     Mon     90.33 83.35
Heart           25-44 M       WNH     Mon     90.33 83.35
Heart           45-64 M       WNH     Mon     90.33 83.35
Heart           65-74 M       WNH     Mon     90.33 83.35
Heart           75+ M       WNH     Mon     90.33 83.35
Reply | Threaded
Open this post in threaded view
|

Re: addition problem

Butler, Deborah {FLNA}
Sort cases by cause ages county.
Aggregate outfile=*
 /break=cause ages county
 /max_F max_M=Max(F_Sum M_sum).
Compute total=sum(max_F,max_M).

Then, of course, you could match it back to the original file to attach
the total.  Hope this helps - let me know if I'm misunderstanding your
problem.


Debbie Butler
SCP Modeling Analyst
Frito Lay Operations


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Gary E Stevens
Sent: Monday, October 30, 2006 1:46 PM
To: [hidden email]
Subject: addition problem

I want to find the highest value in one column and add it to the highest
value in another column.
In the example below, by gender, I want to find the 90.77 in F_sum in
females (which happens to be BNH)
and the 83.35 in M_sum (WNH) and achieve the sum of 174.12.  Different
causes below heart will have different groupings.
Since I will never know the sum values, I can't figure out how to grab
the
highest values in various causes, counties and years.
Thanks for any direction.

Cause           Ages   Gender  Raceethn County  F_sum  M_sum
Heart           0-14 F       BNH     Mon     90.77 83.22
Heart           15-24 F       BNH     Mon     90.77 83.22
Heart           25-44 F       BNH     Mon     90.77 83.22
Heart           45-64 F       BNH     Mon     90.77 83.22
Heart           65-74 F       BNH     Mon     90.77 83.22
Heart           75+ F       BNH     Mon     90.77 83.22
Heart           45-64 F       Hisp Mon     89.38 83.22
Heart           65-74 F       Hisp Mon     89.38 83.22
Heart           75+ F       Hisp Mon     89.38 83.22
Heart           25-44 F       WNH     Mon     90.33 83.35
Heart           45-64 F       WNH     Mon     90.33 83.35
Heart           65-74 F       WNH     Mon     90.33 83.35
Heart           75+ F       WNH     Mon     90.33 83.35
Heart           25-44 M       BNH     Mon     90.77 83.22
Heart           45-64 M       BNH     Mon     90.77 83.22
Heart           65-74 M       BNH     Mon     90.77 83.22
Heart           75'     M       BNH     Mon     90.77 83.22
Heart           25-44 M       Hisp Mon     89.38 83.22
Heart           45-64 M       Hisp Mon     89.38 83.22
Heart           65-74 M       Hisp Mon     89.38 83.22
Heart           75+ M       Hisp Mon     89.38 83.22
Heart           15-24 M       WNH     Mon     90.33 83.35
Heart           25-44 M       WNH     Mon     90.33 83.35
Heart           45-64 M       WNH     Mon     90.33 83.35
Heart           65-74 M       WNH     Mon     90.33 83.35
Heart           75+ M       WNH     Mon     90.33 83.35
Reply | Threaded
Open this post in threaded view
|

Re: addition problem

Richard Ristow
At 03:17 PM 10/30/2006, Butler, Deborah {FLNA} wrote:

>Sort cases by cause ages county.
>Aggregate outfile=*
>  /break=cause ages county
>  /max_F max_M=Max(F_Sum M_sum).
>Compute total=sum(max_F,max_M).

I'm not analyzing in detail, but that's precisely the right approach.
Two small additions:

>Sort cases by cause ages county.

is not necessary. (That surprised me, when I learned it a couple of
years ago. You only need it if you use AGGREGATE subcommand
"/PRESORTED"; and THAT's only a good idea for very, very large numbers
of BREAK groups - like hundreds on thousands

In recent versions of SPSS (I don't know when), instead of

>Aggregate outfile=*
>    (etc.)

with MATCH FILES to join to the original file,

use

Aggregate outfile=* MODE=ADDVARIABLES
    (etc.)