Hello all,
For the data set below I am trying to create a new output that will sum Area by Mer and PID, while creating a new column called CorFac (Correction Factor) that will be the percentage of the total area of each Mer and PID that is comprised of Seis equal to 0. Ideas? Suggestions? Mer PID Seis Area 6 1 0 .14 6 2 0 .80 6 3 0 14.27 6 4 0 14.07 6 4 1 .15 6 5 0 .65 6 5 1 .09 Thanks in advance! kevin. |
This solution only provides an output that tells me the percentage of Mer
and PID that is in each Seis category... For example... Mer PID Seis Area PIN_Seis 6 1 0 .14 100 6 2 0 .80 100 6 3 0 14.27 100 6 4 0 14.07 50 6 4 1 .15 50 6 5 0 .65 50 6 5 1 .09 50 However, I want the percentage of Area in Seis 0 Thanks, kevin -----Original Message----- From: Melissa Ives [mailto:[hidden email]] Sent: September 25, 2006 10:18 To: Kevin Bladon Subject: RE: [SPSSX-L] Percentages of cases in one category Sounds like you want to aggregate on Mer and PID with a percentage in (PIN) where SEIS=0. Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Kevin Bladon Sent: Monday, September 25, 2006 11:07 AM To: [hidden email] Subject: [SPSSX-L] Percentages of cases in one category Hello all, For the data set below I am trying to create a new output that will sum Area by Mer and PID, while creating a new column called CorFac (Correction Factor) that will be the percentage of the total area of each Mer and PID that is comprised of Seis equal to 0. Ideas? Suggestions? Mer PID Seis Area 6 1 0 .14 6 2 0 .80 6 3 0 14.27 6 4 0 14.07 6 4 1 .15 6 5 0 .65 6 5 1 .09 Thanks in advance! kevin. PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance. |
In reply to this post by Kevin Bladon
Kevin,
I am sure your problem is much more complicated than whaT I just did below: * hmmmmmmmm. DATA LIST FREE /Mer PID Seis Area. BEGIN DATA 6 1 0 .14 6 2 0 .80 6 3 0 14.27 6 4 0 14.07 6 4 1 .15 6 5 0 .65 6 5 1 .09 END DATA. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=Mer PID /Area_sum = SUM(Area). Select if Seis = 0. Compute CorFac = Area/Area_sum. exe. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]]On Behalf Of Kevin Bladon Sent: Monday, September 25, 2006 12:31 PM To: [hidden email] Subject: Re: Percentages of cases in one category This solution only provides an output that tells me the percentage of Mer and PID that is in each Seis category... For example... Mer PID Seis Area PIN_Seis 6 1 0 .14 100 6 2 0 .80 100 6 3 0 14.27 100 6 4 0 14.07 50 6 4 1 .15 50 6 5 0 .65 50 6 5 1 .09 50 However, I want the percentage of Area in Seis 0 Thanks, kevin -----Original Message----- From: Melissa Ives [mailto:[hidden email]] Sent: September 25, 2006 10:18 To: Kevin Bladon Subject: RE: [SPSSX-L] Percentages of cases in one category Sounds like you want to aggregate on Mer and PID with a percentage in (PIN) where SEIS=0. Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Kevin Bladon Sent: Monday, September 25, 2006 11:07 AM To: [hidden email] Subject: [SPSSX-L] Percentages of cases in one category Hello all, For the data set below I am trying to create a new output that will sum Area by Mer and PID, while creating a new column called CorFac (Correction Factor) that will be the percentage of the total area of each Mer and PID that is comprised of Seis equal to 0. Ideas? Suggestions? Mer PID Seis Area 6 1 0 .14 6 2 0 .80 6 3 0 14.27 6 4 0 14.07 6 4 1 .15 6 5 0 .65 6 5 1 .09 Thanks in advance! kevin. PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance. |
In reply to this post by Kevin Bladon
Kevin:
Is this what you want? ** sample data. DATA LIST FREE /MER PID Seis area. BEGIN DATA 6 1 0 .14 6 2 0 .80 6 3 0 14.27 6 4 0 14.07 6 4 1 .15 6 5 0 .65 6 5 1 .09 END DATA. AGGREGATE OUTFILE = * MODE = ADDVARIABLES /BREAK = mer pid /tot_area = SUM(area). DO IF seis = 0. COMPUTE corfac = area / tot_area. END IF. EXECUTE. The above code gives you the percentage of each case when seis = 0 for each combination of MER - PID. (If you have multiple cases with seis = 0 within a combination of MER - PID, this will require adjustment.) --cheers jim -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Kevin Bladon Sent: Monday, September 25, 2006 11:31 AM To: [hidden email] Subject: Re: Percentages of cases in one category This solution only provides an output that tells me the percentage of Mer and PID that is in each Seis category... For example... Mer PID Seis Area PIN_Seis 6 1 0 .14 100 6 2 0 .80 100 6 3 0 14.27 100 6 4 0 14.07 50 6 4 1 .15 50 6 5 0 .65 50 6 5 1 .09 50 However, I want the percentage of Area in Seis 0 Thanks, kevin -----Original Message----- From: Melissa Ives [mailto:[hidden email]] Sent: September 25, 2006 10:18 To: Kevin Bladon Subject: RE: [SPSSX-L] Percentages of cases in one category Sounds like you want to aggregate on Mer and PID with a percentage in (PIN) where SEIS=0. Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Kevin Bladon Sent: Monday, September 25, 2006 11:07 AM To: [hidden email] Subject: [SPSSX-L] Percentages of cases in one category Hello all, For the data set below I am trying to create a new output that will sum Area by Mer and PID, while creating a new column called CorFac (Correction Factor) that will be the percentage of the total area of each Mer and PID that is comprised of Seis equal to 0. Ideas? Suggestions? Mer PID Seis Area 6 1 0 .14 6 2 0 .80 6 3 0 14.27 6 4 0 14.07 6 4 1 .15 6 5 0 .65 6 5 1 .09 Thanks in advance! kevin. PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance. |
In reply to this post by Kevin Bladon
At 12:07 PM 9/25/2006, Kevin Bladon wrote:
>I am trying to create a new output that will sum Area by Mer and PID, >while creating a new column called CorFac (Correction Factor) that >will be the percentage of the total area of each Mer and PID that is >comprised of Seis equal to 0. First, like everybody else I'm summing by combined categories, PID within Mer; that leaves a small number of categories, with few cases in each. If that isn't what you wanted, say so - did you want two outputs, one summed by Mer and one by PID? Second, also like everybody else, I'm using MODE=ADDVARIABLES on AGGREGATE, so you still have your original cases. That may not be best, here; it looks like you're shifting from a 'cases' view to a 'groups' view, where the summed categories are your units of observation. Anyway, is this what you wanted? Tested; SPSS draft output: GET FILE=TESTDATA. LIST. List |-----------------------------|---------------------------| |Output Created |25-SEP-2006 15:54:56 | |-----------------------------|---------------------------| C:\Documents and Settings\Richard\My Documents\Temporary\SPSS \2006-09-25 Bladon - Percentages of cases in one category.SAV Mer PID Seis Area 6 1 0 .14 6 2 0 .80 6 3 0 14.27 6 4 0 14.07 6 4 1 .15 6 5 0 .65 6 5 1 .09 Number of cases read: 7 Number of cases listed: 7 TEMPORARY. IF (SEIS EQ 0) Area_0 = AREA. IF (SEIS EQ 0) SEIS_0 = 1. AGGREGATE OUTFILE=* MODE=ADDVARIABLES /BREAK = Mer PID /NmbrAll 'No. of cases in this category' = N /NmbrZero 'No. of cases with SEIS = 0' = SUM(SEIS_0) /TotlArea 'Total Area' = SUM(AREA) /ZeroArea 'Area with SEIS=0' = SUM(AREA_0). FORMATS NmbrAll NmbrZero (F3) /TotlArea ZeroArea (F7.2). NUMERIC CorFac (F6.3). VAR LABEL CorFac 'Fraction of area in SEIS=0 plots'. COMPUTE CorFac = ZeroArea/TotlArea. LIST. List |-----------------------------|---------------------------| |Output Created |25-SEP-2006 15:54:56 | C:\Documents and Settings\Richard\My Documents\Temporary\SPSS \2006-09-25 Bladon - Percentages of cases in one category.SAV Mer PID Seis Area NmbrAll NmbrZero TotlArea ZeroArea CorFac 6 1 0 .14 1 1 .14 .14 1.000 6 2 0 .80 1 1 .80 .80 1.000 6 3 0 14.27 1 1 14.27 14.27 1.000 6 4 0 14.07 2 1 14.22 14.07 .989 6 4 1 .15 2 1 14.22 14.07 .989 6 5 0 .65 2 1 .74 .65 .878 6 5 1 .09 2 1 .74 .65 .878 Number of cases read: 7 Number of cases listed: 7 |
Free forum by Nabble | Edit this page |