Find population frequency when multiple response with long strings
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 | * QUESTION: I am trying to calculate frequency of responses for the same value for multiple variables using 'string' category. Specifically, using ICD-9 codes as the primary cause for hospitalization in a population of 200 patients that has multiple hospitalizations and multiple reasons for hospitalization. Example: patientA has been hospitalized 8 times: 2x 'heart attack', 1x 'kidney stone', 4x 'dehydration', 1x 'stroke'. PatientB : 1x 'pneumonia', 1x 'stroke', 1x 'stomach ulcer'. PatientC: 1x 'dehyration', 1x 'heart attack'..etc How do I create frequency of response for the entire population? * SOLUTION posted to SPSSX-L list by rlevesque@videotron.ca on 2001/06/04. DATA LIST LIST /id(A8) cause1(A12) cause2(A12) cause3(A12) cause4(A12). BEGIN DATA 'patientA' 'heart attack''heart attack' 'kidney stone''dehydration' 'patientB' 'pneumonia' 'stroke' 'stomach ulcer' 'patientC' 'dehyration' 'heart attack' END DATA. LIST. * Reformat data. VECTOR cause=cause1 TO cause4. STRING cause(A12). LOOP cnt=1 TO 4. COMPUTE cause=cause(cnt). XSAVE OUTFILE='c:\\temp\\temp.sav' /KEEP=id cause. END LOOP. EXECUTE. GET FILE='c:\\temp\\temp.sav'. SELECT IF LENGTH(RTRIM(cause))>0. AUTORECODE cause /INTO cause1. FREQUENCIES VARIABLES=cause1 /ORDER= ANALYSIS . |
Related pages
...