Compute percentage of patients having each fracture category
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | *I have a dataset with fracture information on 194 children. However, because some children have multiple fractures, I actually have 630 cases entered. * For example, a child with 3 different ribs broken is entered as 3 cases, and a child with one skull fracture and one rib fracture is entered as 2 cases: ID FRACTURE FRACTURECAT 211 rib1 rib 211 rib4 rib 211 rib7 rib 003 skull skull 003 skull rib ... * I simply want to know the percentage of children with rib fractures (i.e., % = [no. of children with at least 1 rib fracture] / 194 X 100), the percentage of children with skull fractures, and so on. I assume it's a simple crosstab I need to do, but how do I prevent the extra rib fractures of one child with rib fractures being counted? *(A) Posted to SPSSX-L list by Raynald Levesque on 2004/07/01. * Website http://pages.infinit.net/rlevesqu/ . DATA LIST LIST /ID(F3) FRACTURE(A8) FRACTURECAT(A8). BEGIN DATA 211 rib1 rib 211 rib4 rib 211 rib7 rib 123 rib2 rib 123 rib5 rib 003 skull skull 003 skull rib 111 head head 128 skull skull END DATA. SAVE OUTFILE='c:\\temp\\original data.sav'. SORT CASES BY id fracturecat. ADD FILES FILE=* /BY=id fracturecat /FIRST=fract1. ADD FILES FILE=* /BY=id /FIRST=nbid. SELECT IF fract1. AGGREGATE OUTFILE=* /BREAK=fracturecat /n=N /nbid=SUM(nbid). COMPUTE nobreak=1. AGGREGATE OUTFILE='c:\\temp\\totalid.sav' /BREAK=nobreak /totalid=SUM(nbid). MATCH FILES FILE=* /TABLE='c:\\temp\\totalid.sav' /BY=nobreak. COMPUTE pc=n/totalid*100. FORMATS pc(PCT5.2). VARIABLE LABEL pc '% with fracture' /totalid 'total # of id'. SUMMARIZE /TABLES=fracturecat n totalid pc /FORMAT=VALIDLIST NOCASENUM TOTAL /TITLE='Case Summaries' /MISSING=VARIABLE /CELLS=NONE . |
Related pages
...