|
Hi,
I have a very large dataset that consists of incidents individuals have conducted - the data are organized by incident not by individual. I have a name ID that lists the unique individuals. I am trying to create a new variable that will sum up for each unique individual how many incidents they have. Essentially I am trying to have a frequency for the number of times their name ID appears in the file. I would only want the figure to show up once for each individual so that summations of the variable still reflect the accurate count. Can someone help me create this variable? Thanks in advance for your assistance! |
|
You might try AGGREGATE with a break on individual. This will provide
you a file by individual and the count or some other statistic, such as average
or sum by individual.
|
|
In reply to this post by Suzanne Rebecca Neusteter-2
Dear Suzanne,
I hope the syntax below is useful. Kind regards, Ruben ***This data contains one line per incident ***Bodycount is the number of victims made by the respondent during the incident DATA LIST FREE/ID INCIDENT BODYCOUNT. BEGIN DATA 1 1 0 1 2 1 1 3 3 1 1 0 1 2 1 2 3 5 2 1 0 2 2 2 2 3 1 4 1 2 4 2 2 4 3 1 5 1 0 5 2 0 6 3 1 END DATA. VAL LAB INCIDENT 1 Burglary 2 Involved in a fight 3 Manslaught. ***The new data contain one line (case) per respondent DATASET DECLARE Respondentdata. AGGREGATE /OUTFILE='Respondentdata' /BREAK=ID /Number_victims=SUM(BODYCOUNT) /Number_incidents=N. VAR LAB Number_victims Total number of victims made (sum of bodycount per incident) /Number_incidents Total number of incidents committed. Date: Sat, 21 Mar 2009 16:05:49 -0400 From: [hidden email] Subject: computing a variable for frequency To: [hidden email] Hi, I have a very large dataset that consists of incidents individuals have conducted - the data are organized by incident not by individual. I have a name ID that lists the unique individuals. I am trying to create a new variable that will sum up for each unique individual how many incidents they have. Essentially I am trying to have a frequency for the number of times their name ID appears in the file. I would only want the figure to show up once for each individual so that summations of the variable still reflect the accurate count. Can someone help me create this variable? Thanks in advance for your assistance! What can you do with the new Windows Live? Find out |
| Free forum by Nabble | Edit this page |
