seeking help with select records

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

seeking help with select records

thara vardhan-2
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
EventRefNum
IncidentRefNum
PersonCNI
IncidentCategory
IncidentFurtherClassification
26230
6860
1000
ROBBERY                             ARMED ROBBERY                          
61109
5168
4594
ROBBERY                             OTHER ROBBERY                          
5348
7763
3778
ROBBERY                             ROBBERY WITH AGGRAVATION                
5348
9330
3778
POWERS - PERSON SEARCH               ITEM/OBJECT FOUND                      
5348
2434
3778
JUDICIAL OFFENCES                   BREACH BAIL CONDITIONS                  
9754
7197
7101
ASSAULT                             GRIEVOUS BODILY HARM(INCL MAL WOUND)    
9754
4220
7101
ROBBERY                             ROBBERY WITH WOUNDING                  
1747
9532
3120
ROBBERY                             ARMED ROBBERY                          
1747
3710
3120
DRUG DETECTION                       POSSESS DRUG/PLANT                      
1132
27111
5348
ROBBERY                             ROBBERY WITH AGGRAVATION                
1132
8127
5348
ASSAULT                             GRIEVOUS BODILY HARM(INCL MAL WOUND)    
4370
5884
6236
ROBBERY                             ARMED ROBBERY                          
4370
5884
9219
ROBBERY                             ARMED ROBBERY                          
7334
8934
4933
MISCELLANEOUS                       ESCAPEE - POLICE CUSTODY                
7334
6653
4933
ROBBERY                             ARMED ROBBERY                          



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

The information contained in this email is intended for the named recipient(s)
only. It may contain private, confidential, copyright or legally privileged
information. If you are not the intended recipient or you have received this
email by mistake, please reply to the author and delete this email immediately.
You must not copy, print, forward or distribute this email, nor place reliance
on its contents. This email and any attachment have been virus scanned. However,
you are requested to conduct a virus scan as well. No liability is accepted
for any loss or damage resulting from a computer virus, or resulting from a delay
or defect in transmission of this email or any attached file. This email does not
constitute a representation by the NSW Police Force unless the author is legally
entitled to do so.


Reply | Threaded
Open this post in threaded view
|

Re: seeking help with select records

John F Hall

 

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

 

[hidden email]

www.surveyresearch.weebly.com

 

 

 

 

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Thara Vardhan
Sent: 09 September 2011 08:18
To: [hidden email]
Subject: seeking help with select records

 

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

EventRefNum

IncidentRefNum

PersonCNI

IncidentCategory

IncidentFurtherClassification

26230

6860

1000

ROBBERY                            

ARMED ROBBERY                          

61109

5168

4594

ROBBERY                            

OTHER ROBBERY                          

5348

7763

3778

ROBBERY                            

ROBBERY WITH AGGRAVATION                

5348

9330

3778

POWERS - PERSON SEARCH              

ITEM/OBJECT FOUND                      

5348

2434

3778

JUDICIAL OFFENCES                  

BREACH BAIL CONDITIONS                  

9754

7197

7101

ASSAULT                            

GRIEVOUS BODILY HARM(INCL MAL WOUND)    

9754

4220

7101

ROBBERY                            

ROBBERY WITH WOUNDING                  

1747

9532

3120

ROBBERY                            

ARMED ROBBERY                          

1747

3710

3120

DRUG DETECTION                      

POSSESS DRUG/PLANT                      

1132

27111

5348

ROBBERY                            

ROBBERY WITH AGGRAVATION                

1132

8127

5348

ASSAULT                            

GRIEVOUS BODILY HARM(INCL MAL WOUND)    

4370

5884

6236

ROBBERY                            

ARMED ROBBERY                          

4370

5884

9219

ROBBERY                            

ARMED ROBBERY                          

7334

8934

4933

MISCELLANEOUS                      

ESCAPEE - POLICE CUSTODY                

7334

6653

4933

ROBBERY                            

ARMED ROBBERY                          

 

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

The information contained in this email is intended for the named recipient(s)
only. It may contain private, confidential, copyright or legally privileged
information. If you are not the intended recipient or you have received this
email by mistake, please reply to the author and delete this email immediately.
You must not copy, print, forward or distribute this email, nor place reliance
on its contents. This email and any attachment have been virus scanned. However,
you are requested to conduct a virus scan as well. No liability is accepted
for any loss or damage resulting from a computer virus, or resulting from a delay
or defect in transmission of this email or any attached file. This email does not
constitute a representation by the NSW Police Force unless the author is legally
entitled to do so.

 

Reply | Threaded
Open this post in threaded view
|

Re: seeking help with select records

Ruben Geert van den Berg
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
EventRefNum
IncidentRefNum
PersonCNI
IncidentCategory
IncidentFurtherClassification
26230
6860
1000
ROBBERY                             ARMED ROBBERY                          
61109
5168
4594
ROBBERY                             OTHER ROBBERY                          
5348
7763
3778
ROBBERY                             ROBBERY WITH AGGRAVATION                
5348
9330
3778
POWERS - PERSON SEARCH               ITEM/OBJECT FOUND                      
5348
2434
3778
JUDICIAL OFFENCES                   BREACH BAIL CONDITIONS                  
9754
7197
7101
ASSAULT                             GRIEVOUS BODILY HARM(INCL MAL WOUND)    
9754
4220
7101
ROBBERY                             ROBBERY WITH WOUNDING                  
1747
9532
3120
ROBBERY                             ARMED ROBBERY                          
1747
3710
3120
DRUG DETECTION                       POSSESS DRUG/PLANT                      
1132
27111
5348
ROBBERY                             ROBBERY WITH AGGRAVATION                
1132
8127
5348
ASSAULT                             GRIEVOUS BODILY HARM(INCL MAL WOUND)    
4370
5884
6236
ROBBERY                             ARMED ROBBERY                          
4370
5884
9219
ROBBERY                             ARMED ROBBERY                          
7334
8934
4933
MISCELLANEOUS                       ESCAPEE - POLICE CUSTODY                
7334
6653
4933
ROBBERY                             ARMED ROBBERY                          



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

The information contained in this email is intended for the named recipient(s)
only. It may contain private, confidential, copyright or legally privileged
information. If you are not the intended recipient or you have received this
email by mistake, please reply to the author and delete this email immediately.
You must not copy, print, forward or distribute this email, nor place reliance
on its contents. This email and any attachment have been virus scanned. However,
you are requested to conduct a virus scan as well. No liability is accepted
for any loss or damage resulting from a computer virus, or resulting from a delay
or defect in transmission of this email or any attached file. This email does not
constitute a representation by the NSW Police Force unless the author is legally
entitled to do so.