|
Good afternoon list,
I have a large data set of inmates and need to determine the offense that is associated with the most recent release date. The file is organized as a flat file with each case having the following variables: Id Sdate.1 to sdate.10 chargedsc.1 to chargedsc.10 with sdate as sentence date and chargedsc as the description of the charge (string). There may only be 1 sentence date or up to 10. In addition some of the dates could be the same date. If there is a sentence date there is always a charge description. It is currently organized in the order of most serious offense so if there is a tie on dates the date closest to the 1st date should be fine. Thanks Brian ====================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 |
|
Brian,
Right now you have a 'wide format' dataset. You can work the problem in that format using a loop-end loop structure easily enough. But you can also work the problem in a 'long format' dataset. This sentence: 'It is currently organized in the order of most serious offense so if there is a tie on dates the date closest to the 1st date should be fine.', is ambigious. I'll guess that you mean that when there are multiple date variables with the same value, the associated charges for that date set are ordered so that the most serious charge is the first listed in date set. The other assumption is that the sentence date is perfectly related to the releases date. Warning. Syntax is not tested. This is where I'd start. First, convert the dataset to a long format. Varstocases make sdate from Sdate.1 to sdate.10/ make chargedsc from chargedsc.1 to chargedsc.10. Aggregate outfile=*/break=id sdate/chargedesc=first(chargedesc). * That reduces the dataset to one with exactly one record per date. * Now, aggregate to save the record for the last date. Aggregate outfile=*/break=id/sdate chargedesc=last(sdate chargedesc). Gene Maguin >>I have a large data set of inmates and need to determine the offense that is associated with the most recent release date. The file is organized as a flat file with each case having the following variables: Id Sdate.1 to sdate.10 chargedsc.1 to chargedsc.10 with sdate as sentence date and chargedsc as the description of the charge (string). There may only be 1 sentence date or up to 10. In addition some of the dates could be the same date. If there is a sentence date there is always a charge description. It is currently organized in the order of most serious offense so if there is a tie on dates the date closest to the 1st date should be fine. ===================== 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 |
| Free forum by Nabble | Edit this page |
