Dear Listserv,
In my hospital discharge dataset, I have the following variables: Procedure 1 Procedure 2 Procedure 3 Procedure 4 Procedure 5 Procedure 6 In each column, if the patient had an inpatient procedure there is a procedure code listed (maximum of 6 procedures per patient can be listed). I would like to add up the total number of procedures each patient had while hospitalized, so I thought I'd code the missing values as "1" and then add up all missing variables and subtract from 6. My questions are (1) if my proposed method makes sense what is the easiest way to code the missing values and add them, and (2) is there a more efficient way to calculate total number of procedures than what I describe above, and if so, can you please describe your method? Thank you in advance! Anthony |
Hi Anthony,
Your method makes sense, but it could be done even easier. I assume you want to count system missing, not user missing values. I call the outcome variable... outcome. Try this (untested!): count outcome = procedure1 to procedure6 (lo thru hi). compute dummy = 1. aggregate outfile = * / break = dummy / outcome = sum (outcome). list outcome. If you want to have the outcomes for men and women separated, replace the break variable by 'sex' (assuming that that's the name of that variable), and remove the compute statement. Cheers!! Albert-Jan --- Anthony Santella <[hidden email]> wrote: > Dear Listserv, > > In my hospital discharge dataset, I have the > following variables: > > Procedure 1 > Procedure 2 > Procedure 3 > Procedure 4 > Procedure 5 > Procedure 6 > > In each column, if the patient had an inpatient > procedure there is a > procedure code listed (maximum of 6 procedures per > patient can be > listed). I would like to add up the total number of > procedures each > patient had while hospitalized, so I thought I'd > code the missing values > as "1" and then add up all missing variables and > subtract from 6. > > My questions are (1) if my proposed method makes > sense what is the easiest > way to code the missing values and add them, and (2) > is there a more > efficient way to calculate total number of > procedures than what I describe > above, and if so, can you please describe your > method? > > Thank you in advance! > > Anthony > ____________________________________________________________________________________ Sponsored Link Mortgage rates near 39yr lows. $310k for $999/mo. Calculate new payment! www.LowerMyBills.com/lre |
In reply to this post by Anthony Santella
if the procedure codes are numeric
missing values procedure1 to procedure6 (1). count n_prodedures = procedure1 to procedure6(lo thru hi). if the codes are strings, and you are going to do something else with them you might want to start with autorecode with /blanks = missing. to see the details of autorecode or any other command Type the command into a syntax window. Highlight it. Click the syntax icon. Art Kendall Social Research Consultants Anthony Santella wrote: >Dear Listserv, > >In my hospital discharge dataset, I have the following variables: > >Procedure 1 >Procedure 2 >Procedure 3 >Procedure 4 >Procedure 5 >Procedure 6 > >In each column, if the patient had an inpatient procedure there is a >procedure code listed (maximum of 6 procedures per patient can be >listed). I would like to add up the total number of procedures each >patient had while hospitalized, so I thought I'd code the missing values >as "1" and then add up all missing variables and subtract from 6. > >My questions are (1) if my proposed method makes sense what is the easiest >way to code the missing values and add them, and (2) is there a more >efficient way to calculate total number of procedures than what I describe >above, and if so, can you please describe your method? > >Thank you in advance! > >Anthony > > > >
Art Kendall
Social Research Consultants |
Free forum by Nabble | Edit this page |