Aggregating a Binary 0/1 Variable

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

Re: Aggregating a Binary 0/1 Variable

Matt Freeman
On Tue, 5 Feb 2013 16:16:11 -0800, David Marso <[hidden email]>
wrote:

>Repeat after me.....
>DATA LIST blah blah blah...
>AGGREGATE blah blah blah.
>LIST....
>--------------
>
>Matt Freeman wrote
>> On Tue, 5 Feb 2013 14:51:53 -0800, Bruce Weaver &lt;
>
>> bruce.weaver@
>
>> &gt;
>> wrote:
>>
>>>Please paste your AGGREGATE syntax and a small dataset that duplicates
the
>>>problem.  Thanks.
>>>
>>>
>>>
>>>Matt Freeman wrote
>>>> I have variables that contain either a 0 or a 1 and to count the
number
>> of
>>>> 1's I'm using the aggregate function.  When there is only a single 1
in

>>>> the column, the aggregate sum is 0. Know anything about this? Thanks!
>>>>
>>>> =====================
>>>> To manage your subscription to SPSSX-L, send a message to
>>>
>>>> LISTSERV@.UGA
>>>
>>>>  (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
>>>
>>>
>>>
>>>
>>>
>>>-----
>>>--
>>>Bruce Weaver
>>>
>
>> bweaver@
>
>>>http://sites.google.com/a/lakeheadu.ca/bweaver/
>>>
>>>"When all else fails, RTFM."
>>>
>>>NOTE: My Hotmail account is not monitored regularly.
>>>To send me an e-mail, please use the address shown above.
>>>
>>>--
>>>View this message in context: http://spssx-
>> discussion.1045642.n5.nabble.com/Aggregating-a-Binary-0-1-Variable-
>> tp5717907p5717908.html
>>>Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>>
>>>=====================
>>>To manage your subscription to SPSSX-L, send a message to
>>>
>
>> LISTSERV@.UGA
>
>>  (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
>>
>> Bruce - I'm using v21 at work and v20 at home. I just tried the exact
same
>> thing I tried at work, at home - not using syntax in either case - and
it
>> worked just fine.
>> At work, on v21, I just entered, in VAR00001, 5 0s and a single 1,
moving

>> the
>> 1 around from case to case.  I ran aggregate (sum)on VAR00001, with no
>> break
>> variable, from the dialogue and I got a column full of 0s each and every
>> time.
>> Could this be a v21 issue?
>>
>> Thanks for your interest in my problem.
>>
>> Matt
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>
>> LISTSERV@.UGA
>
>>  (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
>
>
>
>
>
>-----
>Please reply to the list and not to my personal email.
>Those desiring my consulting or training services please feel free to
email me.
>--
>View this message in context: http://spssx-
discussion.1045642.n5.nabble.com/Aggregating-a-Binary-0-1-Variable-
tp5717907p5717912.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

I'm running windows XP 32-bit.  Thanks for verifying, Tony.

=====================
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: Aggregating a Binary 0/1 Variable

Jon K Peck
In reply to this post by Matt Freeman
The "goofy" part is having just one line for the variable functions.  The Aggregate dialog gives you one line per variable, which I'm more comfortable with.  I'm not suggesting that the other form is wrong - it just feels weird to me.  But both work, at least for me, in V21 as long as you have the same number of variables in each part.


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




From:        Matt Freeman <[hidden email]>
To:        [hidden email],
Date:        02/06/2013 02:47 PM
Subject:        Re: [SPSSX-L] Aggregating a Binary 0/1 Variable
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




On Tue, 5 Feb 2013 16:16:11 -0800, David Marso <[hidden email]>
wrote:

>Repeat after me.....
>DATA LIST blah blah blah...
>AGGREGATE blah blah blah.
>LIST....
>--------------
>
>Matt Freeman wrote
>> On Tue, 5 Feb 2013 14:51:53 -0800, Bruce Weaver &lt;
>
>> bruce.weaver@
>
>> &gt;
>> wrote:
>>
>>>Please paste your AGGREGATE syntax and a small dataset that duplicates
the
>>>problem.  Thanks.
>>>
>>>
>>>
>>>Matt Freeman wrote
>>>> I have variables that contain either a 0 or a 1 and to count the
number
>> of
>>>> 1's I'm using the aggregate function.  When there is only a single 1
in
>>>> the column, the aggregate sum is 0. Know anything about this? Thanks!
>>>>
>>>> =====================
>>>> To manage your subscription to SPSSX-L, send a message to
>>>
>>>> LISTSERV@.UGA
>>>
>>>>  (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
>>>
>>>
>>>
>>>
>>>
>>>-----
>>>--
>>>Bruce Weaver
>>>
>
>> bweaver@
>
>>>
http://sites.google.com/a/lakeheadu.ca/bweaver/
>>>
>>>"When all else fails, RTFM."
>>>
>>>NOTE: My Hotmail account is not monitored regularly.
>>>To send me an e-mail, please use the address shown above.
>>>
>>>--
>>>View this message in context:
http://spssx-
>> discussion.1045642.n5.nabble.com/Aggregating-a-Binary-0-1-Variable-
>> tp5717907p5717908.html
>>>Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>>
>>>=====================
>>>To manage your subscription to SPSSX-L, send a message to
>>>
>
>> LISTSERV@.UGA
>
>>  (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
>>
>> Bruce - I'm using v21 at work and v20 at home. I just tried the exact
same
>> thing I tried at work, at home - not using syntax in either case - and
it
>> worked just fine.
>> At work, on v21, I just entered, in VAR00001, 5 0s and a single 1,
moving
>> the
>> 1 around from case to case.  I ran aggregate (sum)on VAR00001, with no
>> break
>> variable, from the dialogue and I got a column full of 0s each and every
>> time.
>> Could this be a v21 issue?
>>
>> Thanks for your interest in my problem.
>>
>> Matt
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>
>> LISTSERV@.UGA
>
>>  (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
>
>
>
>
>
>-----
>Please reply to the list and not to my personal email.
>Those desiring my consulting or training services please feel free to
email me.
>--
>View this message in context:
http://spssx-
discussion.1045642.n5.nabble.com/Aggregating-a-Binary-0-1-Variable-
tp5717907p5717912.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

Eugene/David - Removing the '/BREAK=' does not change the output.

Also, Jon, my 'goofy' syntax is only a slight variation of the pasted
syntax from running the aggregate command from the dialogue.  In fact it
is from the dialogue that I discovered this issue.  The syntax is only
there for those who asked to see it.

SPSS's Syntax
AGGREGATE
 /OUTFILE=* MODE=ADDVARIABLES
 /BREAK=
 /X_sum=SUM(X)
 /Y_sum=SUM(Y).

My 'Goofy' Syntax
> AGGREGATE
>   /OUTFILE=* MODE=ADDVARIABLES
>   /BREAK=
>   / X_sum Y_sum = SUM(X Y).
> LIST.

=====================
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: Aggregating a Binary 0/1 Variable GOOFY??

David Marso
Administrator
I have always used a single line per function variant whenever possible.
I find the pasted syntax from most of the dialogs to be VERBOSE!
I tend to edit the h#!! out of most of the pasted stuff and lose any DEFAULTs...

What's so goofy about...
AGGREGATE ....
....
    Mn0001 TO Mn1000    = MIN(v0001 TO v1000)
   /Mx0001 TO Mx1000    = MAX(v0001 TO v1000)
/Mean0001 TO Mean1000=MEAN(v0001 TO v1000)
/SD0001 TO SD1000=SD(v0001 TO v1000)
....

Or would you prefer to be "non-goofy" and slavishly paste 4000 lines of crap?





Jon K Peck wrote
The "goofy" part is having just one line for the variable functions.  The
Aggregate dialog gives you one line per variable, which I'm more
comfortable with.  I'm not suggesting that the other form is wrong - it
just feels weird to me.  But both work, at least for me, in V21 as long as
you have the same number of variables in each part.


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




From:   Matt Freeman <[hidden email]>
To:     [hidden email],
Date:   02/06/2013 02:47 PM
Subject:        Re: [SPSSX-L] Aggregating a Binary 0/1 Variable
Sent by:        "SPSSX(r) Discussion" <[hidden email]>



On Tue, 5 Feb 2013 16:16:11 -0800, David Marso <[hidden email]>
wrote:

>Repeat after me.....
>DATA LIST blah blah blah...
>AGGREGATE blah blah blah.
>LIST....
>--------------
>
>Matt Freeman wrote
>> On Tue, 5 Feb 2013 14:51:53 -0800, Bruce Weaver <
>
>> bruce.weaver@
>
>> >
>> wrote:
>>
>>>Please paste your AGGREGATE syntax and a small dataset that duplicates
the
>>>problem.  Thanks.
>>>
>>>
>>>
>>>Matt Freeman wrote
>>>> I have variables that contain either a 0 or a 1 and to count the
number
>> of
>>>> 1's I'm using the aggregate function.  When there is only a single 1
in
>>>> the column, the aggregate sum is 0. Know anything about this? Thanks!
>>>>
>>>> =====================
>>>> To manage your subscription to SPSSX-L, send a message to
>>>
>>>> LISTSERV@.UGA
>>>
>>>>  (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
>>>
>>>
>>>
>>>
>>>
>>>-----
>>>--
>>>Bruce Weaver
>>>
>
>> bweaver@
>
>>>http://sites.google.com/a/lakeheadu.ca/bweaver/
>>>
>>>"When all else fails, RTFM."
>>>
>>>NOTE: My Hotmail account is not monitored regularly.
>>>To send me an e-mail, please use the address shown above.
>>>
>>>--
>>>View this message in context: http://spssx-
>> discussion.1045642.n5.nabble.com/Aggregating-a-Binary-0-1-Variable-
>> tp5717907p5717908.html
>>>Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>>
>>>=====================
>>>To manage your subscription to SPSSX-L, send a message to
>>>
>
>> LISTSERV@.UGA
>
>>  (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
>>
>> Bruce - I'm using v21 at work and v20 at home. I just tried the exact
same
>> thing I tried at work, at home - not using syntax in either case - and
it
>> worked just fine.
>> At work, on v21, I just entered, in VAR00001, 5 0s and a single 1,
moving
>> the
>> 1 around from case to case.  I ran aggregate (sum)on VAR00001, with no
>> break
>> variable, from the dialogue and I got a column full of 0s each and
every
>> time.
>> Could this be a v21 issue?
>>
>> Thanks for your interest in my problem.
>>
>> Matt
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>
>> LISTSERV@.UGA
>
>>  (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
>
>
>
>
>
>-----
>Please reply to the list and not to my personal email.
>Those desiring my consulting or training services please feel free to
email me.
>--
>View this message in context: http://spssx-
discussion.1045642.n5.nabble.com/Aggregating-a-Binary-0-1-Variable-
tp5717907p5717912.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

Eugene/David - Removing the '/BREAK=' does not change the output.

Also, Jon, my 'goofy' syntax is only a slight variation of the pasted
syntax from running the aggregate command from the dialogue.  In fact it
is from the dialogue that I discovered this issue.  The syntax is only
there for those who asked to see it.

SPSS's Syntax
AGGREGATE
  /OUTFILE=* MODE=ADDVARIABLES
  /BREAK=
  /X_sum=SUM(X)
  /Y_sum=SUM(Y).

My 'Goofy' Syntax
> AGGREGATE
>   /OUTFILE=* MODE=ADDVARIABLES
>   /BREAK=
>   / X_sum Y_sum = SUM(X Y).
> LIST.

=====================
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
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: Aggregating a Binary 0/1 Variable GOOFY??

Bruce Weaver
Administrator
Perhaps Jon prefers to do it via Python.  :-|  

David Marso wrote
I have always used a single line per function variant whenever possible.
I find the pasted syntax from most of the dialogs to be VERBOSE!
I tend to edit the h#!! out of most of the pasted stuff and lose any DEFAULTs...

What's so goofy about...
AGGREGATE ....
....
    Mn0001 TO Mn1000    = MIN(v0001 TO v1000)
   /Mx0001 TO Mx1000    = MAX(v0001 TO v1000)
/Mean0001 TO Mean1000=MEAN(v0001 TO v1000)
/SD0001 TO SD1000=SD(v0001 TO v1000)
....

Or would you prefer to be "non-goofy" and slavishly paste 4000 lines of crap?





Jon K Peck wrote
The "goofy" part is having just one line for the variable functions.  The
Aggregate dialog gives you one line per variable, which I'm more
comfortable with.  I'm not suggesting that the other form is wrong - it
just feels weird to me.  But both work, at least for me, in V21 as long as
you have the same number of variables in each part.


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




From:   Matt Freeman <[hidden email]>
To:     [hidden email],
Date:   02/06/2013 02:47 PM
Subject:        Re: [SPSSX-L] Aggregating a Binary 0/1 Variable
Sent by:        "SPSSX(r) Discussion" <[hidden email]>



On Tue, 5 Feb 2013 16:16:11 -0800, David Marso <[hidden email]>
wrote:

>Repeat after me.....
>DATA LIST blah blah blah...
>AGGREGATE blah blah blah.
>LIST....
>--------------
>
>Matt Freeman wrote
>> On Tue, 5 Feb 2013 14:51:53 -0800, Bruce Weaver <
>
>> bruce.weaver@
>
>> >
>> wrote:
>>
>>>Please paste your AGGREGATE syntax and a small dataset that duplicates
the
>>>problem.  Thanks.
>>>
>>>
>>>
>>>Matt Freeman wrote
>>>> I have variables that contain either a 0 or a 1 and to count the
number
>> of
>>>> 1's I'm using the aggregate function.  When there is only a single 1
in
>>>> the column, the aggregate sum is 0. Know anything about this? Thanks!
>>>>
>>>> =====================
>>>> To manage your subscription to SPSSX-L, send a message to
>>>
>>>> LISTSERV@.UGA
>>>
>>>>  (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
>>>
>>>
>>>
>>>
>>>
>>>-----
>>>--
>>>Bruce Weaver
>>>
>
>> bweaver@
>
>>>http://sites.google.com/a/lakeheadu.ca/bweaver/
>>>
>>>"When all else fails, RTFM."
>>>
>>>NOTE: My Hotmail account is not monitored regularly.
>>>To send me an e-mail, please use the address shown above.
>>>
>>>--
>>>View this message in context: http://spssx-
>> discussion.1045642.n5.nabble.com/Aggregating-a-Binary-0-1-Variable-
>> tp5717907p5717908.html
>>>Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>>
>>>=====================
>>>To manage your subscription to SPSSX-L, send a message to
>>>
>
>> LISTSERV@.UGA
>
>>  (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
>>
>> Bruce - I'm using v21 at work and v20 at home. I just tried the exact
same
>> thing I tried at work, at home - not using syntax in either case - and
it
>> worked just fine.
>> At work, on v21, I just entered, in VAR00001, 5 0s and a single 1,
moving
>> the
>> 1 around from case to case.  I ran aggregate (sum)on VAR00001, with no
>> break
>> variable, from the dialogue and I got a column full of 0s each and
every
>> time.
>> Could this be a v21 issue?
>>
>> Thanks for your interest in my problem.
>>
>> Matt
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>
>> LISTSERV@.UGA
>
>>  (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
>
>
>
>
>
>-----
>Please reply to the list and not to my personal email.
>Those desiring my consulting or training services please feel free to
email me.
>--
>View this message in context: http://spssx-
discussion.1045642.n5.nabble.com/Aggregating-a-Binary-0-1-Variable-
tp5717907p5717912.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

Eugene/David - Removing the '/BREAK=' does not change the output.

Also, Jon, my 'goofy' syntax is only a slight variation of the pasted
syntax from running the aggregate command from the dialogue.  In fact it
is from the dialogue that I discovered this issue.  The syntax is only
there for those who asked to see it.

SPSS's Syntax
AGGREGATE
  /OUTFILE=* MODE=ADDVARIABLES
  /BREAK=
  /X_sum=SUM(X)
  /Y_sum=SUM(Y).

My 'Goofy' Syntax
> AGGREGATE
>   /OUTFILE=* MODE=ADDVARIABLES
>   /BREAK=
>   / X_sum Y_sum = SUM(X Y).
> LIST.

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Aggregating a Binary 0/1 Variable GOOFY??

David Marso
Administrator
Now that would be goofy ;-)
--
Bruce Weaver wrote
Perhaps Jon prefers to do it via Python.  :-|  

David Marso wrote
I have always used a single line per function variant whenever possible.
I find the pasted syntax from most of the dialogs to be VERBOSE!
I tend to edit the h#!! out of most of the pasted stuff and lose any DEFAULTs...

What's so goofy about...
AGGREGATE ....
....
    Mn0001 TO Mn1000    = MIN(v0001 TO v1000)
   /Mx0001 TO Mx1000    = MAX(v0001 TO v1000)
/Mean0001 TO Mean1000=MEAN(v0001 TO v1000)
/SD0001 TO SD1000=SD(v0001 TO v1000)
....

Or would you prefer to be "non-goofy" and slavishly paste 4000 lines of crap?





Jon K Peck wrote
The "goofy" part is having just one line for the variable functions.  The
Aggregate dialog gives you one line per variable, which I'm more
comfortable with.  I'm not suggesting that the other form is wrong - it
just feels weird to me.  But both work, at least for me, in V21 as long as
you have the same number of variables in each part.


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




From:   Matt Freeman <[hidden email]>
To:     [hidden email],
Date:   02/06/2013 02:47 PM
Subject:        Re: [SPSSX-L] Aggregating a Binary 0/1 Variable
Sent by:        "SPSSX(r) Discussion" <[hidden email]>



On Tue, 5 Feb 2013 16:16:11 -0800, David Marso <[hidden email]>
wrote:

>Repeat after me.....
>DATA LIST blah blah blah...
>AGGREGATE blah blah blah.
>LIST....
>--------------
>
>Matt Freeman wrote
>> On Tue, 5 Feb 2013 14:51:53 -0800, Bruce Weaver <
>
>> bruce.weaver@
>
>> >
>> wrote:
>>
>>>Please paste your AGGREGATE syntax and a small dataset that duplicates
the
>>>problem.  Thanks.
>>>
>>>
>>>
>>>Matt Freeman wrote
>>>> I have variables that contain either a 0 or a 1 and to count the
number
>> of
>>>> 1's I'm using the aggregate function.  When there is only a single 1
in
>>>> the column, the aggregate sum is 0. Know anything about this? Thanks!
>>>>
>>>> =====================
>>>> To manage your subscription to SPSSX-L, send a message to
>>>
>>>> LISTSERV@.UGA
>>>
>>>>  (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
>>>
>>>
>>>
>>>
>>>
>>>-----
>>>--
>>>Bruce Weaver
>>>
>
>> bweaver@
>
>>>http://sites.google.com/a/lakeheadu.ca/bweaver/
>>>
>>>"When all else fails, RTFM."
>>>
>>>NOTE: My Hotmail account is not monitored regularly.
>>>To send me an e-mail, please use the address shown above.
>>>
>>>--
>>>View this message in context: http://spssx-
>> discussion.1045642.n5.nabble.com/Aggregating-a-Binary-0-1-Variable-
>> tp5717907p5717908.html
>>>Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>>
>>>=====================
>>>To manage your subscription to SPSSX-L, send a message to
>>>
>
>> LISTSERV@.UGA
>
>>  (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
>>
>> Bruce - I'm using v21 at work and v20 at home. I just tried the exact
same
>> thing I tried at work, at home - not using syntax in either case - and
it
>> worked just fine.
>> At work, on v21, I just entered, in VAR00001, 5 0s and a single 1,
moving
>> the
>> 1 around from case to case.  I ran aggregate (sum)on VAR00001, with no
>> break
>> variable, from the dialogue and I got a column full of 0s each and
every
>> time.
>> Could this be a v21 issue?
>>
>> Thanks for your interest in my problem.
>>
>> Matt
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>
>> LISTSERV@.UGA
>
>>  (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
>
>
>
>
>
>-----
>Please reply to the list and not to my personal email.
>Those desiring my consulting or training services please feel free to
email me.
>--
>View this message in context: http://spssx-
discussion.1045642.n5.nabble.com/Aggregating-a-Binary-0-1-Variable-
tp5717907p5717912.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

Eugene/David - Removing the '/BREAK=' does not change the output.

Also, Jon, my 'goofy' syntax is only a slight variation of the pasted
syntax from running the aggregate command from the dialogue.  In fact it
is from the dialogue that I discovered this issue.  The syntax is only
there for those who asked to see it.

SPSS's Syntax
AGGREGATE
  /OUTFILE=* MODE=ADDVARIABLES
  /BREAK=
  /X_sum=SUM(X)
  /Y_sum=SUM(Y).

My 'Goofy' Syntax
> AGGREGATE
>   /OUTFILE=* MODE=ADDVARIABLES
>   /BREAK=
>   / X_sum Y_sum = SUM(X Y).
> LIST.

=====================
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
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: Aggregating a Binary 0/1 Variable GOOFY??

Jon K Peck
In reply to this post by Bruce Weaver
begin program.
import spss
spss.Submit("""AGGREGATE
  /OUTFILE=* MODE=ADDVARIABLES
  /BREAK=
  /X_sum=SUM(X)
  /Y_sum=SUM(Y).""")

end program.

:-)


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




From:        Bruce Weaver <[hidden email]>
To:        [hidden email],
Date:        02/06/2013 03:38 PM
Subject:        Re: [SPSSX-L] Aggregating a Binary 0/1 Variable GOOFY??
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Perhaps Jon prefers to do it via Python.  :-|


David Marso wrote
> I have always used a single line per function variant whenever possible.
> I find the pasted syntax from most of the dialogs to be VERBOSE!
> I tend to edit the h#!! out of most of the pasted stuff and lose any
> DEFAULTs...
>
> What's so goofy about...
> AGGREGATE ....
> ....
>     Mn0001 TO Mn1000    = MIN(v0001 TO v1000)
>    /Mx0001 TO Mx1000    = MAX(v0001 TO v1000)
> /Mean0001 TO Mean1000=MEAN(v0001 TO v1000)
> /SD0001 TO SD1000=SD(v0001 TO v1000)
> ....
>
> Or would you prefer to be "non-goofy" and slavishly paste 4000 lines of
> crap?
>
>
>
>
> Jon K Peck wrote
>> The "goofy" part is having just one line for the variable functions.  The
>> Aggregate dialog gives you one line per variable, which I'm more
>> comfortable with.  I'm not suggesting that the other form is wrong - it
>> just feels weird to me.  But both work, at least for me, in V21 as long
>> as
>> you have the same number of variables in each part.
>>
>>
>> Jon Peck (no "h") aka Kim
>> Senior Software Engineer, IBM

>> peck@.ibm

>> new phone: 720-342-5621
>>
>>
>>
>>
>> From:   Matt Freeman &lt;

>> mattfreeman74@

>> &gt;
>> To:

>> SPSSX-L@.uga

>> ,
>> Date:   02/06/2013 02:47 PM
>> Subject:        Re: [SPSSX-L] Aggregating a Binary 0/1 Variable
>> Sent by:        "SPSSX(r) Discussion" &lt;

>> SPSSX-L@.uga

>> &gt;
>>
>>
>>
>> On Tue, 5 Feb 2013 16:16:11 -0800, David Marso &lt;

>> david.marso@

>> &gt;
>> wrote:
>>
>>>Repeat after me.....
>>>DATA LIST blah blah blah...
>>>AGGREGATE blah blah blah.
>>>LIST....
>>>--------------
>>>
>>>Matt Freeman wrote
>>>> On Tue, 5 Feb 2013 14:51:53 -0800, Bruce Weaver &lt;
>>>
>>>> bruce.weaver@
>>>
>>>> &gt;
>>>> wrote:
>>>>
>>>>>Please paste your AGGREGATE syntax and a small dataset that duplicates
>> the
>>>>>problem.  Thanks.
>>>>>
>>>>>
>>>>>
>>>>>Matt Freeman wrote
>>>>>> I have variables that contain either a 0 or a 1 and to count the
>> number
>>>> of
>>>>>> 1's I'm using the aggregate function.  When there is only a single 1
>> in
>>>>>> the column, the aggregate sum is 0. Know anything about this? Thanks!
>>>>>>
>>>>>> =====================
>>>>>> To manage your subscription to SPSSX-L, send a message to
>>>>>
>>>>>> LISTSERV@.UGA
>>>>>
>>>>>>  (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
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>-----
>>>>>--
>>>>>Bruce Weaver
>>>>>
>>>
>>>> bweaver@
>>>
>>>>>
http://sites.google.com/a/lakeheadu.ca/bweaver/
>>>>>
>>>>>"When all else fails, RTFM."
>>>>>
>>>>>NOTE: My Hotmail account is not monitored regularly.
>>>>>To send me an e-mail, please use the address shown above.
>>>>>
>>>>>--
>>>>>View this message in context:
http://spssx-
>>>> discussion.1045642.n5.nabble.com/Aggregating-a-Binary-0-1-Variable-
>>>> tp5717907p5717908.html
>>>>>Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>>>>
>>>>>=====================
>>>>>To manage your subscription to SPSSX-L, send a message to
>>>>>
>>>
>>>> LISTSERV@.UGA
>>>
>>>>  (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
>>>>
>>>> Bruce - I'm using v21 at work and v20 at home. I just tried the exact
>> same
>>>> thing I tried at work, at home - not using syntax in either case - and
>> it
>>>> worked just fine.
>>>> At work, on v21, I just entered, in VAR00001, 5 0s and a single 1,
>> moving
>>>> the
>>>> 1 around from case to case.  I ran aggregate (sum)on VAR00001, with no
>>>> break
>>>> variable, from the dialogue and I got a column full of 0s each and
>> every
>>>> time.
>>>> Could this be a v21 issue?
>>>>
>>>> Thanks for your interest in my problem.
>>>>
>>>> Matt
>>>>
>>>> =====================
>>>> To manage your subscription to SPSSX-L, send a message to
>>>
>>>> LISTSERV@.UGA
>>>
>>>>  (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
>>>
>>>
>>>
>>>
>>>
>>>-----
>>>Please reply to the list and not to my personal email.
>>>Those desiring my consulting or training services please feel free to
>> email me.
>>>--
>>>View this message in context:
http://spssx-
>> discussion.1045642.n5.nabble.com/Aggregating-a-Binary-0-1-Variable-
>> tp5717907p5717912.html
>>>Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>>
>>>=====================
>>>To manage your subscription to SPSSX-L, send a message to
>>>

>> LISTSERV@.UGA

>>  (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
>>
>> Eugene/David - Removing the '/BREAK=' does not change the output.
>>
>> Also, Jon, my 'goofy' syntax is only a slight variation of the pasted
>> syntax from running the aggregate command from the dialogue.  In fact it
>> is from the dialogue that I discovered this issue.  The syntax is only
>> there for those who asked to see it.
>>
>> SPSS's Syntax
>> AGGREGATE
>>   /OUTFILE=* MODE=ADDVARIABLES
>>   /BREAK=
>>   /X_sum=SUM(X)
>>   /Y_sum=SUM(Y).
>>
>> My 'Goofy' Syntax
>>> AGGREGATE
>>>   /OUTFILE=* MODE=ADDVARIABLES
>>>   /BREAK=
>>>   / X_sum Y_sum = SUM(X Y).
>>> LIST.
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to

>> LISTSERV@.UGA

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





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Aggregating-a-Binary-0-1-Variable-tp5717907p5717945.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


Reply | Threaded
Open this post in threaded view
|

Re: Aggregating a Binary 0/1 Variable GOOFY??

David Marso
Administrator
Pay attention Jon ;-)
Bruce and I were way beyond the original and pondering whether you would explicitly pythonicate.
4000 lines later?  The Back end gasps at the prospect of parsing 4000 functions ;-((
--
AGGREGATE ....
....
    Mn0001 TO Mn1000    = MIN(v0001 TO v1000)
   /Mx0001 TO Mx1000    = MAX(v0001 TO v1000)
/Mean0001 TO Mean1000=MEAN(v0001 TO v1000)
/SD0001 TO SD1000=SD(v0001 TO v1000)
....
Jon K Peck wrote
begin program.
import spss
spss.Submit("""AGGREGATE
   /OUTFILE=* MODE=ADDVARIABLES
   /BREAK=
   /X_sum=SUM(X)
   /Y_sum=SUM(Y).""")
end program.

:-)


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




From:   Bruce Weaver <[hidden email]>
To:     [hidden email],
Date:   02/06/2013 03:38 PM
Subject:        Re: [SPSSX-L] Aggregating a Binary 0/1 Variable GOOFY??
Sent by:        "SPSSX(r) Discussion" <[hidden email]>



Perhaps Jon prefers to do it via Python.  :-|


David Marso wrote
> I have always used a single line per function variant whenever possible.
> I find the pasted syntax from most of the dialogs to be VERBOSE!
> I tend to edit the h#!! out of most of the pasted stuff and lose any
> DEFAULTs...
>
> What's so goofy about...
> AGGREGATE ....
> ....
>     Mn0001 TO Mn1000    = MIN(v0001 TO v1000)
>    /Mx0001 TO Mx1000    = MAX(v0001 TO v1000)
> /Mean0001 TO Mean1000=MEAN(v0001 TO v1000)
> /SD0001 TO SD1000=SD(v0001 TO v1000)
> ....
>
> Or would you prefer to be "non-goofy" and slavishly paste 4000 lines of
> crap?
>
>
>
>
> Jon K Peck wrote
>> The "goofy" part is having just one line for the variable functions.
The
>> Aggregate dialog gives you one line per variable, which I'm more
>> comfortable with.  I'm not suggesting that the other form is wrong - it
>> just feels weird to me.  But both work, at least for me, in V21 as long
>> as
>> you have the same number of variables in each part.
>>
>>
>> Jon Peck (no "h") aka Kim
>> Senior Software Engineer, IBM

>> peck@.ibm

>> new phone: 720-342-5621
>>
>>
>>
>>
>> From:   Matt Freeman <

>> mattfreeman74@

>> >
>> To:

>> SPSSX-L@.uga

>> ,
>> Date:   02/06/2013 02:47 PM
>> Subject:        Re: [SPSSX-L] Aggregating a Binary 0/1 Variable
>> Sent by:        "SPSSX(r) Discussion" <

>> SPSSX-L@.uga

>> >
>>
>>
>>
>> On Tue, 5 Feb 2013 16:16:11 -0800, David Marso <

>> david.marso@

>> >
>> wrote:
>>
>>>Repeat after me.....
>>>DATA LIST blah blah blah...
>>>AGGREGATE blah blah blah.
>>>LIST....
>>>--------------
>>>
>>>Matt Freeman wrote
>>>> On Tue, 5 Feb 2013 14:51:53 -0800, Bruce Weaver <
>>>
>>>> bruce.weaver@
>>>
>>>> >
>>>> wrote:
>>>>
>>>>>Please paste your AGGREGATE syntax and a small dataset that
duplicates
>> the
>>>>>problem.  Thanks.
>>>>>
>>>>>
>>>>>
>>>>>Matt Freeman wrote
>>>>>> I have variables that contain either a 0 or a 1 and to count the
>> number
>>>> of
>>>>>> 1's I'm using the aggregate function.  When there is only a single
1
>> in
>>>>>> the column, the aggregate sum is 0. Know anything about this?
Thanks!
>>>>>>
>>>>>> =====================
>>>>>> To manage your subscription to SPSSX-L, send a message to
>>>>>
>>>>>> LISTSERV@.UGA
>>>>>
>>>>>>  (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
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>-----
>>>>>--
>>>>>Bruce Weaver
>>>>>
>>>
>>>> bweaver@
>>>
>>>>>http://sites.google.com/a/lakeheadu.ca/bweaver/
>>>>>
>>>>>"When all else fails, RTFM."
>>>>>
>>>>>NOTE: My Hotmail account is not monitored regularly.
>>>>>To send me an e-mail, please use the address shown above.
>>>>>
>>>>>--
>>>>>View this message in context: http://spssx-
>>>> discussion.1045642.n5.nabble.com/Aggregating-a-Binary-0-1-Variable-
>>>> tp5717907p5717908.html
>>>>>Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>>>>
>>>>>=====================
>>>>>To manage your subscription to SPSSX-L, send a message to
>>>>>
>>>
>>>> LISTSERV@.UGA
>>>
>>>>  (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
>>>>
>>>> Bruce - I'm using v21 at work and v20 at home. I just tried the exact
>> same
>>>> thing I tried at work, at home - not using syntax in either case -
and
>> it
>>>> worked just fine.
>>>> At work, on v21, I just entered, in VAR00001, 5 0s and a single 1,
>> moving
>>>> the
>>>> 1 around from case to case.  I ran aggregate (sum)on VAR00001, with
no
>>>> break
>>>> variable, from the dialogue and I got a column full of 0s each and
>> every
>>>> time.
>>>> Could this be a v21 issue?
>>>>
>>>> Thanks for your interest in my problem.
>>>>
>>>> Matt
>>>>
>>>> =====================
>>>> To manage your subscription to SPSSX-L, send a message to
>>>
>>>> LISTSERV@.UGA
>>>
>>>>  (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
>>>
>>>
>>>
>>>
>>>
>>>-----
>>>Please reply to the list and not to my personal email.
>>>Those desiring my consulting or training services please feel free to
>> email me.
>>>--
>>>View this message in context: http://spssx-
>> discussion.1045642.n5.nabble.com/Aggregating-a-Binary-0-1-Variable-
>> tp5717907p5717912.html
>>>Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>>
>>>=====================
>>>To manage your subscription to SPSSX-L, send a message to
>>>

>> LISTSERV@.UGA

>>  (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
>>
>> Eugene/David - Removing the '/BREAK=' does not change the output.
>>
>> Also, Jon, my 'goofy' syntax is only a slight variation of the pasted
>> syntax from running the aggregate command from the dialogue.  In fact
it
>> is from the dialogue that I discovered this issue.  The syntax is only
>> there for those who asked to see it.
>>
>> SPSS's Syntax
>> AGGREGATE
>>   /OUTFILE=* MODE=ADDVARIABLES
>>   /BREAK=
>>   /X_sum=SUM(X)
>>   /Y_sum=SUM(Y).
>>
>> My 'Goofy' Syntax
>>> AGGREGATE
>>>   /OUTFILE=* MODE=ADDVARIABLES
>>>   /BREAK=
>>>   / X_sum Y_sum = SUM(X Y).
>>> LIST.
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to

>> LISTSERV@.UGA

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





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Aggregating-a-Binary-0-1-Variable-tp5717907p5717945.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
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?"
12