|
I could use some help (please) with identifying records in a hospital
inpatient dataset which have one or more of several ICD9 codes, in one or more of 10 variables. Although I would not be surprised if the answer was in the list archives somewhere, I could not find what I was looking for after searching for quite some time. I suspect many of you deal with this specific task regularly. I would like to end up with a variable (diabetes, range 0 to 10) which contains the number of specified ICD9 codes found in a particular record. I have not used the VECTOR command previously and probably do not have the best understanding of it yet. So...the syntax below is what I have come up with so far. I get an error message saying that diagnoses is an incorrect variable name. I *can* do this without using vector by specifying each individual ds variable, but it seems like there must be a better way. Is VECTOR the answer? Suggestions? Thanks! If there is a better way to represent all of the ICD9 codes being searched for, please suggest a solution for that as well. I only show two codes below for brevity, but the list is actually much longer. Many thanks! -David *ds1 to ds10 are all numeric variables in numeric order and adjacent to each other in the dataset. *Using SPSS version 15.0.1 (Windows). COMPUTE diabetes=0. VECTOR diagnoses=ds1 TO ds10. IF diagnoses=250 diabetes=diabetes+1. IF diagnoses=25000 diabetes=diabetes+1. EXECUTE. |
|
Look at the COUNT command. No vectors required.
The VECTOR command is most useful inside of loops. There are some examples in Help to lead you along. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Laflamme, David Sent: Wednesday, August 22, 2007 10:21 AM To: [hidden email] Subject: Identifying records with specific ICD9 codes? I could use some help (please) with identifying records in a hospital inpatient dataset which have one or more of several ICD9 codes, in one or more of 10 variables. Although I would not be surprised if the answer was in the list archives somewhere, I could not find what I was looking for after searching for quite some time. I suspect many of you deal with this specific task regularly. I would like to end up with a variable (diabetes, range 0 to 10) which contains the number of specified ICD9 codes found in a particular record. I have not used the VECTOR command previously and probably do not have the best understanding of it yet. So...the syntax below is what I have come up with so far. I get an error message saying that diagnoses is an incorrect variable name. I *can* do this without using vector by specifying each individual ds variable, but it seems like there must be a better way. Is VECTOR the answer? Suggestions? Thanks! If there is a better way to represent all of the ICD9 codes being searched for, please suggest a solution for that as well. I only show two codes below for brevity, but the list is actually much longer. Many thanks! -David *ds1 to ds10 are all numeric variables in numeric order and adjacent to each other in the dataset. *Using SPSS version 15.0.1 (Windows). COMPUTE diabetes=0. VECTOR diagnoses=ds1 TO ds10. IF diagnoses=250 diabetes=diabetes+1. IF diagnoses=25000 diabetes=diabetes+1. EXECUTE. |
|
In reply to this post by Laflamme, David
At 12:21 PM 8/22/2007, Laflamme, David wrote:
>*ds1 to ds10 are all numeric variables in numeric order and adjacent >to >each other in the dataset. >*Using SPSS version 15.0.1 (Windows). > >COMPUTE diabetes=0. > >VECTOR diagnoses=ds1 TO ds10. > >IF diagnoses=250 diabetes=diabetes+1. >IF diagnoses=25000 diabetes=diabetes+1. Replace the last two lines with the following (untested): LOOP #DX_Num = 1 TO 10. . IF diagnoses(#DX_Num)=250 diabetes=diabetes+1. . IF diagnoses(#DX_Num)=25000 diabetes=diabetes+1. END LOOP. |
|
In reply to this post by Laflamme, David
Thanks to all of you who have suggested solutions. Here is what I ended
up with, showing all the ICD9 codes. It appears to work, though I will do some checks just to be sure. A nice and short solution! Much appreciated. I will be sure to remember this command. Can't believe I hadn't used it yet! COUNT diabetes=ds1 to ds10 (250 25000 25002 25010 25012 25020 25022 25030 25032 25040 25042 25050 25052 25060 25062 25070 25072 25080 25082 25090 25092 2535 2714 2750 3371 3572 3620 36201 36641 44381 7071 7318). EXECUTE. I'm also including the various responses below in case they are of help to others. -David -----Original Message----- From: ViAnn Beadle Sent: Wednesday, August 22, 2007 12:42 PM To: Laflamme, David; [hidden email] Subject: RE: Identifying records with specific ICD9 codes? Look at the COUNT command. No vectors required. The VECTOR command is most useful inside of loops. There are some examples in Help to lead you along. -----Original Message----- From: Richard Ristow Sent: Wednesday, August 22, 2007 12:50 PM To: Laflamme, David; [hidden email] Subject: Re: Identifying records with specific ICD9 codes? Replace the last two lines with the following (untested): LOOP #DX_Num = 1 TO 10. . IF diagnoses(#DX_Num)=250 diabetes=diabetes+1. . IF diagnoses(#DX_Num)=25000 diabetes=diabetes+1. END LOOP. -----Original Message----- From: Gene Maguin Sent: Wednesday, August 22, 2007 12:31 PM To: Laflamme, David Subject: RE: Identifying records with specific ICD9 codes? David, Doing this is probably not too hard. Vector is one method. Do repeat is another. Remember that vector requires the variables declared to be part of the vector must be contigious in the datatset. Do repeat does not make that requirement. I can't comment right now, however. But a question (please post back to list rather than to me): are the ICD9 codes of interest contigious or the codes of interest a subset of a larger group of contigious diabetes codes. So, 756.00 thru 786.90 vs (756.1, 756.25, 756.83). -----Original Message----- From: Laflamme, David Sent: Wednesday, August 22, 2007 12:21 PM To: '[hidden email]' Subject: Identifying records with specific ICD9 codes? I could use some help (please) with identifying records in a hospital inpatient dataset which have one or more of several ICD9 codes, in one or more of 10 variables. Although I would not be surprised if the answer was in the list archives somewhere, I could not find what I was looking for after searching for quite some time. I suspect many of you deal with this specific task regularly. I would like to end up with a variable (diabetes, range 0 to 10) which contains the number of specified ICD9 codes found in a particular record. I have not used the VECTOR command previously and probably do not have the best understanding of it yet. So...the syntax below is what I have come up with so far. I get an error message saying that diagnoses is an incorrect variable name. I *can* do this without using vector by specifying each individual ds variable, but it seems like there must be a better way. Is VECTOR the answer? Suggestions? Thanks! If there is a better way to represent all of the ICD9 codes being searched for, please suggest a solution for that as well. I only show two codes below for brevity, but the list is actually much longer. Many thanks! -David *ds1 to ds10 are all numeric variables in numeric order and adjacent to each other in the dataset. *Using SPSS version 15.0.1 (Windows). COMPUTE diabetes=0. VECTOR diagnoses=ds1 TO ds10. IF diagnoses=250 diabetes=diabetes+1. IF diagnoses=25000 diabetes=diabetes+1. EXECUTE. |
|
In reply to this post by Laflamme, David
I use this according to how specific a value I'm looking for.
(then count or crosstab) SUBSTR reads specific values left to right for x places and any number after that. STRING Primcause (A10). STRING ICD9 (A10). STRING ICD10 (A10). COMPUTE ICD9_3 = SUBSTR(ICD9,1,3). COMPUTE ICD9_4 = SUBSTR(ICD9,1,4). COMPUTE ICD9_5 = SUBSTR(ICD9,1,5). IF (ICD9_3 >= '250') Primcause = 'Diabetes'. IF (ICD10_3 >= 'E10' & ICD10_3 <= 'E14') Primcause = 'Diabetes'. EXECUTE. |
| Free forum by Nabble | Edit this page |
