Hello,
I suspect these are straight forward problems but I haven't found a ready solution. I'm working with data where there are multiple records per individual. The data is generated from a database and I don't have control over how it is formatted. The data includes hospital admissions and discharges, so an individual might have 9 rows and another has two. Each individual has a unique id. I have used the 'Identify duplicate cases' option to get a count of unique values, however, I also want to obtain a count of number of admissions by a third variable, District. Identify duplicates may identify there were five individuals admitted to district A and 10 to district B etc. I want a count of admission number by district. For example, Admission # 1 2 3 4 5 ...... District A 3 2 B 5 3 2 C Advice on how I can do this is appreciated. Regards Bob ===================== 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 |
Have you checked to see if Aggregate will work. Seems like it would if each record consisted of an admit date-discharge date pair but wouldn't if each record was a transaction where a transaction could be a discharge, admission, transfer, etc. Since you don't describe the record structure, we can't tell what you have.
Gene Maguin -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Bob Green Sent: Tuesday, September 03, 2013 5:02 PM To: [hidden email] Subject: Working with data with multiple records per individual Hello, I suspect these are straight forward problems but I haven't found a ready solution. I'm working with data where there are multiple records per individual. The data is generated from a database and I don't have control over how it is formatted. The data includes hospital admissions and discharges, so an individual might have 9 rows and another has two. Each individual has a unique id. I have used the 'Identify duplicate cases' option to get a count of unique values, however, I also want to obtain a count of number of admissions by a third variable, District. Identify duplicates may identify there were five individuals admitted to district A and 10 to district B etc. I want a count of admission number by district. For example, Admission # 1 2 3 4 5 ...... District A 3 2 B 5 3 2 C Advice on how I can do this is appreciated. Regards Bob ===================== 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 ===================== 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 |
Gene,
Thanks for your reply. I looked at Aggregate but don't understand how to use the 'Aggregated variables' 'Summary of variable's'. If I wanted average age or something, this would be clear, but I want a count of admissions per individual within a district. The data structure is much like I originally described (there are a couple of other variables such as admission reason and length of admission but that's it). Each individual patient may have one or more admissions, id is constant. Patient Id Name admissiondate discharge date los district reason Regards Bob > Have you checked to see if Aggregate will work. Seems like it would if > each record consisted of an admit date-discharge date pair but wouldn't if > each record was a transaction where a transaction could be a discharge, > admission, transfer, etc. Since you don't describe the record structure, > we can't tell what you have. > Gene Maguin > > -----Original Message----- > From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of > Bob Green > Sent: Tuesday, September 03, 2013 5:02 PM > To: [hidden email] > Subject: Working with data with multiple records per individual > > Hello, > > I suspect these are straight forward problems but I haven't found a ready > solution. > > I'm working with data where there are multiple records per individual. The > data is generated from a database and I don't have control over how it is > formatted. > > > The data includes hospital admissions and discharges, so an individual > might have 9 rows and another has two. Each individual has a unique id. > > > I have used the 'Identify duplicate cases' option to get a count of unique > values, however, I also want to obtain a count of number of admissions by > a third variable, District. Identify duplicates may identify there were > five individuals admitted to district A and 10 to district B etc. I want a > count of admission number by district. > > For example, > > Admission # 1 2 3 4 5 ...... > District > A 3 2 > B 5 3 2 > C > > Advice on how I can do this is appreciated. > > Regards > > Bob > > ===================== > 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 > > ===================== > 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 > ===================== 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 |
Ok, so a record is an admission-discharge pair.
Aggregate outfile=*/break=district/totaladmits=nu. This gives the number of admissions for each district. Somebody who has been admitted and discharged 5 times contributes 5 to the count. Admissions per individual sounds like a ratio: number of admissions divided by number of unique persons. Is this true? Well suppose it is. Then Aggregate outfile=*/break=id/personadmits=nu. Aggregate outfile=*/break=district/people=nu/totaladmits=sum(personadmits). Gene Maguin -----Original Message----- From: [hidden email] [mailto:[hidden email]] Sent: Tuesday, September 03, 2013 7:13 PM To: Maguin, Eugene Cc: [hidden email] Subject: Re: Working with data with multiple records per individual Gene, Thanks for your reply. I looked at Aggregate but don't understand how to use the 'Aggregated variables' 'Summary of variable's'. If I wanted average age or something, this would be clear, but I want a count of admissions per individual within a district. The data structure is much like I originally described (there are a couple of other variables such as admission reason and length of admission but that's it). Each individual patient may have one or more admissions, id is constant. Patient Id Name admissiondate discharge date los district reason Regards Bob > Have you checked to see if Aggregate will work. Seems like it would if > each record consisted of an admit date-discharge date pair but > wouldn't if each record was a transaction where a transaction could be > a discharge, admission, transfer, etc. Since you don't describe the > record structure, we can't tell what you have. > Gene Maguin > > -----Original Message----- > From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf > Of Bob Green > Sent: Tuesday, September 03, 2013 5:02 PM > To: [hidden email] > Subject: Working with data with multiple records per individual > > Hello, > > I suspect these are straight forward problems but I haven't found a > ready solution. > > I'm working with data where there are multiple records per individual. > The data is generated from a database and I don't have control over > how it is formatted. > > > The data includes hospital admissions and discharges, so an individual > might have 9 rows and another has two. Each individual has a unique id. > > > I have used the 'Identify duplicate cases' option to get a count of > unique values, however, I also want to obtain a count of number of > admissions by a third variable, District. Identify duplicates may > identify there were five individuals admitted to district A and 10 to > district B etc. I want a count of admission number by district. > > For example, > > Admission # 1 2 3 4 5 ...... > District > A 3 2 > B 5 3 2 > C > > Advice on how I can do this is appreciated. > > Regards > > Bob > > ===================== > 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 > > ===================== > 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 > ===================== 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 |
Gene,
Thanks, admission and discharge are dates rather than a numerical value. The syntax below basically does what I want AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=DISTRICT /Consumerid_mean=MEAN(Consumerid). CROSSTABS /TABLES=Consumerid BY daysabsent BY DISTRICT /FORMAT=AVALUE TABLES /CELLS=COUNT /COUNT ROUND CELL. Regards Bob > Ok, so a record is an admission-discharge pair. > > > Aggregate outfile=*/break=district/totaladmits=nu. > > This gives the number of admissions for each district. Somebody who has > been admitted and discharged 5 times contributes 5 to the count. > > Admissions per individual sounds like a ratio: number of admissions > divided by number of unique persons. Is this true? > Well suppose it is. Then > > Aggregate outfile=*/break=id/personadmits=nu. > Aggregate > outfile=*/break=district/people=nu/totaladmits=sum(personadmits). > > Gene Maguin > > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] > Sent: Tuesday, September 03, 2013 7:13 PM > To: Maguin, Eugene > Cc: [hidden email] > Subject: Re: Working with data with multiple records per individual > > Gene, > > Thanks for your reply. > > I looked at Aggregate but don't understand how to use the 'Aggregated > variables' 'Summary of variable's'. If I wanted average age or something, > this would be clear, but I want a count of admissions per individual > within a district. > > The data structure is much like I originally described (there are a couple > of other variables such as admission reason and length of admission but > that's it). Each individual patient may have one or more admissions, id > is constant. > > Patient Id Name admissiondate discharge date los district reason > > > Regards > > Bob > >> Have you checked to see if Aggregate will work. Seems like it would if >> each record consisted of an admit date-discharge date pair but >> wouldn't if each record was a transaction where a transaction could be >> a discharge, admission, transfer, etc. Since you don't describe the >> record structure, we can't tell what you have. >> Gene Maguin >> >> -----Original Message----- >> From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf >> Of Bob Green >> Sent: Tuesday, September 03, 2013 5:02 PM >> To: [hidden email] >> Subject: Working with data with multiple records per individual >> >> Hello, >> >> I suspect these are straight forward problems but I haven't found a >> ready solution. >> >> I'm working with data where there are multiple records per individual. >> The data is generated from a database and I don't have control over >> how it is formatted. >> >> >> The data includes hospital admissions and discharges, so an individual >> might have 9 rows and another has two. Each individual has a unique id. >> >> >> I have used the 'Identify duplicate cases' option to get a count of >> unique values, however, I also want to obtain a count of number of >> admissions by a third variable, District. Identify duplicates may >> identify there were five individuals admitted to district A and 10 to >> district B etc. I want a count of admission number by district. >> >> For example, >> >> Admission # 1 2 3 4 5 ...... >> District >> A 3 2 >> B 5 3 2 >> C >> >> Advice on how I can do this is appreciated. >> >> Regards >> >> Bob >> >> ===================== >> 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 >> >> ===================== >> 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 >> > > ===================== > 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 > ===================== 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 |
Administrator
|
In reply to this post by Maguin, Eugene
I also wasn't entirely certain what Brian was asking for, but wondered if he meant number of admissions for each ID*district combination. If so, he'll need both ID and district as break variables.
HTH.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Free forum by Nabble | Edit this page |