Dear list members
I have to compute a variable that will help me identify incidents that were robbery alone as opposed those which involved other incident categories too for example: Eventrefnum 1132 where there was an incident of assault as well as robbery. Each event involves either only person or two persons as can be seen from Eventrefnum 4370 - where there are 2 distinct personnci numbers. Ho do I compute or identify these records? I would be grateful if any member could help me? many thanks thara The data is structured in the following way: SAMPLE DUMMY DATA
|
Thara Try this (tested): compute serial = $casenum . autorecode IncidentCategory IncidentFurtherClassification /into inc1 inc2 /group . format serial inc1 inc2 (f1.0) /EventRefNum (f6.0). var labels inc1 'Incident Category' / inc2 'Incident Further Classification' . freq inc1 inc2 . compute z = 0. compute y = lag (EventRefNum,1). if (EventRefNum = y) z = z + 1. freq z . temp. select if (z = 1). list serial EventRefNum . Does it do what you want? John F Hall From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Thara Vardhan Dear list members
|
In reply to this post by thara vardhan-2
Hi Thara,
Perhaps you can 'recode' the incidentcategory into a robbery marker and then use aggregate with mode=addvariables. If a category classified as robbery is recoded into 1 and 0 otherwise, the mean over records within an event will be 1 for robbery only, 0 for no robbery and between 0 and 1 for events involving robbery but not exclusively. Making some assumptions, an example could be compute t1= index(lower(IncidentCategory),'robbery')>0. AGGREGATE /out * mode addvariables /break EventRefNum /onlyrob=mean(t1). delete variables t1. recode onlyrob(1=1)(0=0)(else=2). value labels onlyrob 1'Event is only robbery'0'Event does not involve robbery'2'Event involves robbery but not exclusively'. exe. HTH Date: Fri, 9 Sep 2011 16:17:53 +1000 From: [hidden email] Subject: seeking help with select records To: [hidden email] Dear list members I have to compute a variable that will help me identify incidents that were robbery alone as opposed those which involved other incident categories too for example: Eventrefnum 1132 where there was an incident of assault as well as robbery. Each event involves either only person or two persons as can be seen from Eventrefnum 4370 - where there are 2 distinct personnci numbers. Ho do I compute or identify these records? I would be grateful if any member could help me? many thanks thara The data is structured in the following way: SAMPLE DUMMY DATA
|
Free forum by Nabble | Edit this page |