Reputation: 1
I have a question on SPSS. I want to compute a variable, which counts the number of incidents in a number of cases. It is a bit complicated, so I hope I explain it well.
My data is multilevel. I have houses, that are linked to streets, which are linked to neighbourhoods. In some streets there are multiple houses, and in some neighbourhoods multiple streets. The main case is the house. So every house has a street and a neighbourhood linked to it.
What I want to know, is how many houses in a street were burgled (1=yes; 2=attempt; 3=no burglary)
So I have a score on burglary (yes/attempt/no) for every house. And for every house I have an observationnumber for the street it is in. In some streets, I have more than one house. So the street observationnumber is in the file multiple times.
Is it possible to automatically create a variable that counts the number of burglaries and attempts for each street? This means it should be able to look at different cases (the houses) and make one count for the street. If the street has only one house, it is easy. But if the street has multiple houses (which is often the case), I want to know per street how many houses were burgled. If the observationnumber for the street is for example 19001, and five houses are in that street, of which 1 is burgled and 1 had an attempt, can SPSS create a variable that counts the number of burgled and attempted burglery houses in street 19001? I am worried I might have to do this manually, because I cannot seem to make it work.
I hope my question is clear and someone can help me with it!
Kind regards, Marlijn.
Upvotes: 0
Views: 882
Reputation: 5417
Use AGGREGATE on the street variable as the break with SUM as the statistic. Choose to put this information in a new dataset or add it back to the individual records. If the street names are not globally unique, you would need to use multiple break variables to make this unique.
Upvotes: 2