|
I have a access table with a mere two variables one uniquely identifies
the Individual and the other identifies the group i.e: John Doe Alpha John Roe Alpha Jane Doe Beta Jane Roe Beta Steve Doe Gamma Steve Roe Gamma Henry Doe Gamma I want to create another variable, which counts the number of occurrences for each group: John Doe Alpha 1 John Roe Alpha 2 Jane Doe Beta 1 Jane Roe Beta 2 Steve Doe Gamma 1 Steve Roe Gamma 2 Henry Doe Gamma 3 ===================== 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 |
|
This should work for you :
Compute SeqNo = 1. IF (Var1 =Lag(Var1) and Var2=Lag(Var2)) SeqNo = 1 +lag(SeqNo). Regards. Edward -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jeremy McDonald Sent: Monday, May 05, 2008 11:09 AM To: [hidden email] Subject: count within group I have a access table with a mere two variables one uniquely identifies the Individual and the other identifies the group i.e: John Doe Alpha John Roe Alpha Jane Doe Beta Jane Roe Beta Steve Doe Gamma Steve Roe Gamma Henry Doe Gamma I want to create another variable, which counts the number of occurrences for each group: John Doe Alpha 1 John Roe Alpha 2 Jane Doe Beta 1 Jane Roe Beta 2 Steve Doe Gamma 1 Steve Roe Gamma 2 Henry Doe Gamma 3 ===================== 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 |
|
In reply to this post by Jeremy McDonald
Hi there,
Try this, DATA LIST free/ Name (a50) group (a14). Begin data John_Doe Alpha John_Roe Alpha Jane_Doe Beta Jane_Roe Beta Steve_Doe Gamma Steve_Roe Gamma Henry_Doe Gamma End data. SORT CASES BY group (A) . Compute Number_occr = 1. if (group = lag(group, 1)) Number_occr = lag(Number_occr , 1)+1. Exe. Thanks, Mahbub Khandoker -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jeremy McDonald Sent: Monday, May 05, 2008 11:09 AM To: [hidden email] Subject: count within group I have a access table with a mere two variables one uniquely identifies the Individual and the other identifies the group i.e: John Doe Alpha John Roe Alpha Jane Doe Beta Jane Roe Beta Steve Doe Gamma Steve Roe Gamma Henry Doe Gamma I want to create another variable, which counts the number of occurrences for each group: John Doe Alpha 1 John Roe Alpha 2 Jane Doe Beta 1 Jane Roe Beta 2 Steve Doe Gamma 1 Steve Roe Gamma 2 Henry Doe Gamma 3 ===================== 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 ______________________________________________________________________ This email has been scanned by the CAMH Email Security System. ______________________________________________________________________ ______________________________________________________________________ This email has been scanned by the CAMH Email Security System. ______________________________________________________________________ ===================== 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 |
| Free forum by Nabble | Edit this page |
