|
Hi, All, I encountered a data process problem in SPSS.
Here are the data sample: location seqid value flag a 1 a 2 a 2 b 3 a 3 c 2 a 4 d 3 a 5 a 1 a 6 c 2 a 7 d 3 a 8 a 1 a 9 b 2 a 10 c 2 a 11 d 3 b 1 a 2 b 2 b 3 b 3 c 2 b 4 d 3 b 5 a 1 b 6 c 2 b 7 d 3 I want to process the data based on the following logic. In a sepecial location, I want to make a group including 3 continue sequence where the flag of first 2 observations not eq 1. If flag = 1 then stop and start a new group. The following is the result I hope get: location groupid value_1 value_2 value_3 flag1 flag2 flag3 a 1 a b c 2 3 2 a 2 b c d 3 2 3 a 3 c d a 2 3 1 a 4 c d a 2 3 1 a 5 b c k 2 2 3 a 6 c k d 2 3 3 b 7 a b c 2 3 2 b 8 b c d 3 2 3 b 9 c d a 2 3 1 Many thanks! KD ===================== 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 |
|
KD,
Can you elaborate... how can 'k' possibly emerge as a value in your desired sequence only a - d are in your data set? a 1 a b c 2 3 2 a 2 b c d 3 2 3 a 3 c d a 2 3 1 a 4 c d a 2 3 1 a 5 b c K 2 2 3 -- ? a 6 c K d 2 3 3 -- ? b 7 a b c 2 3 2 b 8 b c d 3 2 3 b 9 c d a 2 3 1 Bob Walker Surveys & Forecasts, LLC www.safllc.com -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Kd Sent: Monday, October 18, 2010 1:02 AM To: [hidden email] Subject: A data process problem in SPSS Hi, All, I encountered a data process problem in SPSS. Here are the data sample: location seqid value flag a 1 a 2 a 2 b 3 a 3 c 2 a 4 d 3 a 5 a 1 a 6 c 2 a 7 d 3 a 8 a 1 a 9 b 2 a 10 c 2 a 11 d 3 b 1 a 2 b 2 b 3 b 3 c 2 b 4 d 3 b 5 a 1 b 6 c 2 b 7 d 3 I want to process the data based on the following logic. In a sepecial location, I want to make a group including 3 continue sequence where the flag of first 2 observations not eq 1. If flag = 1 then stop and start a new group. The following is the result I hope get: location groupid value_1 value_2 value_3 flag1 flag2 flag3 a 1 a b c 2 3 2 a 2 b c d 3 2 3 a 3 c d a 2 3 1 a 4 c d a 2 3 1 a 5 b c k 2 2 3 a 6 c k d 2 3 3 b 7 a b c 2 3 2 b 8 b c d 3 2 3 b 9 c d a 2 3 1 Many thanks! KD ===================== 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 |
| Free forum by Nabble | Edit this page |
