Hello,
I am trying to count the number of events that occurred before and after specified dates (in this case, the number of arrests before and after a period of incarceration). I have date variables (both in YRMODA and MM/DD/YY format) for all arrests (ARRDATE.1 to ARRDATE.98 - the number of arrest records vary from case to case) as well as prison admission (ORGADDATE) and release (RELDATE). I know how to count the total number of arrests, but I'm having trouble figuring out how to put the condition in (that is, if the arrest occurred before or after incarceration). I'm assuming this is quite simple; however, I would greatly appreciate any direction folks could provide. Thanks, Lee ===================== 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 |
Lee,
I'm assuming your data look like Id orgaddate reldate arrdate.1 .... Arrdate.98. With one record per person which implies one inceration. I'm also going to assume that arrdate.1 to arrdate.98 are arranged from earliest to latest and that a symis date value means sysmis date values for all subsequent arrdate.(i) variables. Can we assume that no arrests are possible between orgaddate reldate? And, therefore, that if arrdate.(i) gt orgaddate, arrdate.(i) is also gt reldate? I will make this assumption. Since your data are already in wide format, I would use this code. Vector arrest=arrdate.1 to arrdate.98. Compute before=0. Compute after=0. Loop #i=1 to 98. + do if (sysmis(arrest(#i)). + break. + else if (arrest(#i) le orgaddate). + compute before=before+1. + else. + compute after=after+1. + end if. End loop. Gene Maguin -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lee Sent: Tuesday, April 12, 2011 2:50 PM To: [hidden email] Subject: counting events before and after specified date Hello, I am trying to count the number of events that occurred before and after specified dates (in this case, the number of arrests before and after a period of incarceration). I have date variables (both in YRMODA and MM/DD/YY format) for all arrests (ARRDATE.1 to ARRDATE.98 - the number of arrest records vary from case to case) as well as prison admission (ORGADDATE) and release (RELDATE). I know how to count the total number of arrests, but I'm having trouble figuring out how to put the condition in (that is, if the arrest occurred before or after incarceration). I'm assuming this is quite simple; however, I would greatly appreciate any direction folks could provide. Thanks, Lee ===================== 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 Lee
Hi Lee,
This isn't the exact answer to your question, but I asked the list about a similar issue previously where I had referral dates and wanted to know how many of them occurred during a probation episode. So, I wanted to count how many events happened between the start and end dates and you want to know how many occurred before a start date and after an end date. The logic provided may help you solve your own problem. Here is a link to the thread: http://www.listserv.uga.edu/cgi-bin/wa?S2=spssx-l&q=&s=Count+%23+of+Events+Within+an+Episode&f=&a=&b= I hope this helps. If not, others may use the info in the thread to help you further. Thanks, Ariel On Tue, Apr 12, 2011 at 1:50 PM, Lee <[hidden email]> wrote: Hello, |
Free forum by Nabble | Edit this page |