|
can someone help me do this?
I have many rows of data corresponding to customer investments they ahve purchased. ID is unique for a given certificate. I have a variable Jumbo which can be either 1, 2, or 3. I have another variable AsOfDt which contains the current date. So for each certificate, there will be many different rows of data corresponding to different AsOfDt's (different monthly data). What I want to do is for all certificates where Jumbo = 2, I want to count the unique number of ID's. Many ID's will repeat again and again for different AsOfDt's but some might disappear. So I want to split the file by Jumbo,a dn then calculate the unique number of ID's under each of the three jumbo's. any advice greatly appreciated. thanks. |
|
JimJohn,
Read up on the Aggregate command. Sounds like you need to aggregate twice. Once by breaking on ID and Jumbo and counting the number of records for each id-jumbo combination. Second by breaking on jumbo only and counting the records for each value of jumbo. I haven't tested this but I think it will do what you want. The first aggregate pass will give you one record for each id-jumbo combination. The second aggregate pass will give you one record for each jumbo value, i.e., a total of three records. The count for each record is the number of unique ids for a given value of jumbo. Gene Maguin >>I have many rows of data corresponding to customer investments they ahve purchased. ID is unique for a given certificate. I have a variable Jumbo which can be either 1, 2, or 3. I have another variable AsOfDt which contains the current date. So for each certificate, there will be many different rows of data corresponding to different AsOfDt's (different monthly data). What I want to do is for all certificates where Jumbo = 2, I want to count the unique number of ID's. Many ID's will repeat again and again for different AsOfDt's but some might disappear. So I want to split the file by Jumbo,a dn then calculate the unique number of ID's under each of the three jumbo's. any advice greatly appreciated. thanks. ===================== 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 |
|
If I understand his issue, this syntax should work I think:
Run this: SORT CASES BY JUMBO ID. MATCH FILES FILE = */BY JUMBO ID /LAST=DL. FREQ VAR = DL. THEN, RUN FREQUENCY BY JUMBO ON DL TO GET COUNT. Sort cases by jumbo. Split file by jumbo. Freq var = dl. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Gene Maguin Sent: Friday, January 23, 2009 3:59 PM To: [hidden email] Subject: Re: Count Unique JimJohn, Read up on the Aggregate command. Sounds like you need to aggregate twice. Once by breaking on ID and Jumbo and counting the number of records for each id-jumbo combination. Second by breaking on jumbo only and counting the records for each value of jumbo. I haven't tested this but I think it will do what you want. The first aggregate pass will give you one record for each id-jumbo combination. The second aggregate pass will give you one record for each jumbo value, i.e., a total of three records. The count for each record is the number of unique ids for a given value of jumbo. Gene Maguin >>I have many rows of data corresponding to customer investments they ahve purchased. ID is unique for a given certificate. I have a variable Jumbo which can be either 1, 2, or 3. I have another variable AsOfDt which contains the current date. So for each certificate, there will be many different rows of data corresponding to different AsOfDt's (different monthly data). What I want to do is for all certificates where Jumbo = 2, I want to count the unique number of ID's. Many ID's will repeat again and again for different AsOfDt's but some might disappear. So I want to split the file by Jumbo,a dn then calculate the unique number of ID's under each of the three jumbo's. any advice greatly appreciated. thanks. ===================== 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 jimjohn
Does this do what you want? Art
Data List FIXED /ID 1-2 Jumbo 4 AsofDt 6-13 (ADATE). BEGIN DATA 01 1 01/12/08 01 1 02/13/08 01 1 03/23/08 02 2 02/21/08 02 2 11/10/08 03 2 12/23/08 03 2 01/10/09 03 2 12/12/08 03 2 12/20/08 04 3 03/23/08 04 3 04/02/08 End Data. DATASET DECLARE Agg1. SORT CASES BY Jumbo ID. AGGREGATE /OUTFILE='Agg1' /PRESORTED /BREAK=Jumbo ID /N_BREAK=N. * Count for Jumbo is number of unique IDs for each value of Jumbo. DATASET ACTIVATE Agg1. FREQUENCIES VARIABLES=Jumbo /ORDER=ANALYSIS. -----Original Message----- From: jimjohn [mailto:[hidden email]] Sent: Friday, January 23, 2009 12:44 PM To: [hidden email] Subject: Count Unique can someone help me do this? I have many rows of data corresponding to customer investments they ahve purchased. ID is unique for a given certificate. I have a variable Jumbo which can be either 1, 2, or 3. I have another variable AsOfDt which contains the current date. So for each certificate, there will be many different rows of data corresponding to different AsOfDt's (different monthly data). What I want to do is for all certificates where Jumbo = 2, I want to count the unique number of ID's. Many ID's will repeat again and again for different AsOfDt's but some might disappear. So I want to split the file by Jumbo,a dn then calculate the unique number of ID's under each of the three jumbo's. any advice greatly appreciated. thanks. -- View this message in context: http://www.nabble.com/Count-Unique-tp21632320p21632320.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 |
| Free forum by Nabble | Edit this page |
