Creating a New Variable from SUM of Values

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

Creating a New Variable from SUM of Values

JosephYoungblood
Hello,

Please note I do not take anyone's time for granted, and prior to posting this question, I searched the archive and attempted to construct the desired solution, both using SPSS Syntax and in Excel.

My dataset has roughly 58 variables and 47k cases.  Cases are sorted First by their Seg_Number (not unique) and Secondly by their SubSeg_Number (unique).  As the example below illustrates the conditions within the data; some Seg_Numb
ers have a single SubSeg_Number, and some have more than one SubSeg_Number.


ALL cases include the length for each SubSegment.  What I need to do is to create a new VAR "Seg_Length" that represents the SUMMED VALUE of all SubSeg_Lengths.

Seg_Number          SubSeg_Number          SubSeg_Length          NEW VARIABLE "Seg_Length"
 
005                         00000005_1                         1460          (Computed Value should be 4492)
005                         00000005_2                         1637          (Computed Value should be 4492)
005                         00000005_3                         1132          (Computed Value should be 4492)
005                         00000005_4                         263            (Computed Value should be 4492)
008                         00000008_1                         185            (Computed Value should be 185)
009                         00000009_1                         207            (Computed Value should be 207)
009                         00000009_2                         0                (Computed Value should be  0)
119                         00000119_1                         200            (Computed Value should be 437)
119                         00000119_2                         110            (Computed Value should be 437)
119                         00000119_3                         127            (Computed Value should be 437)


Thank you,

Joseph A. Youngblood

Reply | Threaded
Open this post in threaded view
|

Re: Creating a New Variable from SUM of Values

David Marso
Administrator
AGGREGATE!!!!
--------
JosephYoungblood wrote
Hello,

Please note I do not take anyone's time for granted, and prior to posting this question, I searched the archive and attempted to construct the desired solution, both using SPSS Syntax and in Excel.

My dataset has roughly 58 variables and 47k cases.  Cases are sorted First by their Seg_Number (not unique) and Secondly by their SubSeg_Number (unique).  As the example below illustrates the conditions within the data; some Seg_Numb
ers have a single SubSeg_Number, and some have more than one SubSeg_Number.


ALL cases include the length for each SubSegment.  What I need to do is to create a new VAR "Seg_Length" that represents the SUMMED VALUE of all SubSeg_Lengths.

Seg_Number          SubSeg_Number          SubSeg_Length          NEW VARIABLE "Seg_Length"
 
005                         00000005_1                         1460          (Computed Value should be 4492)
005                         00000005_2                         1637          (Computed Value should be 4492)
005                         00000005_3                         1132          (Computed Value should be 4492)
005                         00000005_4                         263            (Computed Value should be 4492)
008                         00000008_1                         185            (Computed Value should be 185)
009                         00000009_1                         207            (Computed Value should be 207)
009                         00000009_2                         0                (Computed Value should be  0)
119                         00000119_1                         200            (Computed Value should be 437)
119                         00000119_2                         110            (Computed Value should be 437)
119                         00000119_3                         127            (Computed Value should be 437)


Thank you,

Joseph A. Youngblood
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?"
Reply | Threaded
Open this post in threaded view
|

Re: Creating a New Variable from SUM of Values

Jon K Peck
For those of you who may be puzzled or offended by David's orthography, you should know that his keyboard has no period key: it was replaced with an autorepeating exclamation mark key.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        David Marso <[hidden email]>
To:        [hidden email]
Date:        10/20/2014 05:50 PM
Subject:        Re: [SPSSX-L] Creating a New Variable from SUM of Values
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




AGGREGATE!!!!
--------

JosephYoungblood wrote
> Hello,
>
> Please note I do not take anyone's time for granted, and prior to posting
> this question, I searched the archive and attempted to construct the
> desired solution, both using SPSS Syntax and in Excel.
>
> My dataset has roughly 58 variables and 47k cases.  Cases are sorted First
> by their Seg_Number (not unique) and Secondly by their SubSeg_Number
> (unique).  As the example below illustrates the conditions within the
> data; some Seg_Numb

> ers have a single SubSeg_Number, and some have more than one
> SubSeg_Number.
>
> ALL cases include the length for each SubSegment.  What I need to do is to
> create a new VAR "Seg_Length" that represents the SUMMED VALUE of all
> SubSeg_Lengths.
>
> Seg_Number          SubSeg_Number          SubSeg_Length          NEW
> VARIABLE "Seg_Length"
>                                    
> 005                         00000005_1                         1460        
> (Computed Value should be 4492)
> 005                         00000005_2                         1637        
> (Computed Value should be 4492)
> 005                         00000005_3                         1132        
> (Computed Value should be 4492)
> 005                         00000005_4                         263          
> (Computed Value should be 4492)
> 008                         00000008_1                         185          
> (Computed Value should be 185)
> 009                         00000009_1                         207          
> (Computed Value should be 207)
> 009                         00000009_2                         0              
> (Computed Value should be  0)
> 119                         00000119_1                         200          
> (Computed Value should be 437)
> 119                         00000119_2                         110          
> (Computed Value should be 437)
> 119                         00000119_3                         127          
> (Computed Value should be 437)
>
>
> Thank you,
>
> Joseph A. Youngblood





-----
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?"
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Creating-a-New-Variable-from-SUM-of-Values-tp5727654p5727655.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

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


===================== 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: Creating a New Variable from SUM of Values

King Douglas

My second laugh of the day…the first being the result of the autorepeating exclamation mark.

 

Thanks, Jon.

 

King

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jon K Peck
Sent: Monday, October 20, 2014 10:34 PM
To: [hidden email]
Subject: Re: Creating a New Variable from SUM of Values

 

For those of you who may be puzzled or offended by David's orthography, you should know that his keyboard has no period key: it was replaced with an autorepeating exclamation mark key.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        David Marso <[hidden email]>
To:        [hidden email]
Date:        10/20/2014 05:50 PM
Subject:        Re: [SPSSX-L] Creating a New Variable from SUM of Values
Sent by:        "SPSSX(r) Discussion" <[hidden email]>





AGGREGATE!!!!
--------

JosephYoungblood wrote
> Hello,
>
> Please note I do not take anyone's time for granted, and prior to posting
> this question, I searched the archive and attempted to construct the
> desired solution, both using SPSS Syntax and in Excel.
>
> My dataset has roughly 58 variables and 47k cases.  Cases are sorted First
> by their Seg_Number (not unique) and Secondly by their SubSeg_Number
> (unique).  As the example below illustrates the conditions within the
> data; some Seg_Numb

> ers have a single SubSeg_Number, and some have more than one
> SubSeg_Number.
>
> ALL cases include the length for each SubSegment.  What I need to do is to
> create a new VAR "Seg_Length" that represents the SUMMED VALUE of all
> SubSeg_Lengths.
>
> Seg_Number          SubSeg_Number          SubSeg_Length          NEW
> VARIABLE "Seg_Length"
>                                    
> 005                         00000005_1                         1460        
> (Computed Value should be 4492)
> 005                         00000005_2                         1637        
> (Computed Value should be 4492)
> 005                         00000005_3                         1132        
> (Computed Value should be 4492)
> 005                         00000005_4                         263          
> (Computed Value should be 4492)
> 008                         00000008_1                         185          
> (Computed Value should be 185)
> 009                         00000009_1                         207          
> (Computed Value should be 207)
> 009                         00000009_2                         0              
> (Computed Value should be  0)
> 119                         00000119_1                         200          
> (Computed Value should be 437)
> 119                         00000119_2                         110          
> (Computed Value should be 437)
> 119                         00000119_3                         127          
> (Computed Value should be 437)
>
>
> Thank you,
>
> Joseph A. Youngblood





-----
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?"
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Creating-a-New-Variable-from-SUM-of-Values-tp5727654p5727655.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

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


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

===================== 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: Creating a New Variable from SUM of Values

Art Kendall
In reply to this post by JosephYoungblood
I do not have access to SPSS at the moment so I do not have a demo.

Type "Aggregate." into a syntax window.  Put you cursor on it.
key <f1>  aka <help>
you just need to
use mode = addvariables
use Seg_number as the break variable
/Seg_length = sum(SubSeg_Length
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Creating a New Variable from SUM of Values

JosephYoungblood
Thank you Art.