Hi there,
I am new to stata, I need help with the following
I have a list of procedural codes attached below. I want to search from variables PR1-PR6 for the presence of these, and then check PRDAY1 to PRDAY6 for the presence of zero. So basically PR1 is matched with PRDAY1, PR2 is matched with PRDAY2, etc. A case is included if it has the code for the selected procedure in Var PR1-PR6 and zeroes in the corresponding match Var PRDAY. Below is an example.
Search PR1-PR6 for any of these codes 3511, 3521, 3522, and compute to a new VAR- Aortic valve replacement (AVR) If the corresponding PRDAY is 0 when the code is detected. For instance, a case will be 1 for the AVR variable if PR1 has any of the codes (3511, 3521, 3522) and PRDAY1 is 0. Below is the example dataset, and the list of codes I am searching for. I look forward to any assistance with cheerful optimism.
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input str7(PR1 PR2 PR3 PR4 PR5 PR6) double(PRDAY1 PRDAY2 PRDAY3 PRDAY4 PRDAY5 PRDAY6)
"4562" "4591" "4611" "9904" "9915" "9604" . . . . . .
"4562" "5459" "4593" "5491" "9915" "3897" . . . . . .
"4562" "539" "4673" "3324" "9672" "9604" . . . . . .
"5471" "4562" "4593" "4319" "3897" "3894" . . . . . .
"4652" "4562" "5641" "5451" "5459" "8605" . . . . . .
"4389" "4591" "5491" "3323" "9907" "3897" . . . . . .
"540" "4562" "4679" "4679" "5412" "5412" . . . . . .
"4562" "9672" "5459" "9356" "9604" "3891" . . . . . .
"4562" "4591" "3991" "5423" "4011" "4513" . . . . . .
"6651" "6529" "4562" "4673" "4709" "5459" . . . . . .
"4562" "9915" "5459" "4719" "9904" "3893" . . . . . .
"4573" "4562" "4593" "544" "598" "4525" . . . . . .
"4389" "4591" "4551" "5014" "5123" "4701" . . . . . .
"4551" "8015" "5411" "4593" "8045" "8085" . . . . . .
"4399" "4562" "5459" "4513" "3404" "1771" . . . . . .
"3897" "4438" "4591" "4711" "5123" "5371" . . . . . .
"6841" "6563" "5451" "4562" "5900" "1742" . . . . . .
"4562" "688" "704" "576" "5781" "562" . . . . . .
"741" "6632" "5411" "5459" "4562" "7309" . . . . . .
"5252" "9672" "4562" "5495" "283" "8919" . . . . . .
"3482" "7936" "7937" "5475" "4562" "4675" . . . . . .
"4562" "4709" "5841" "6449" "5822" "4823" . . . . . .
"4652" "4673" "4562" "5459" "4591" "5459" . . . . . .
"6919" "6829" "5902" "4719" "6539" "4562" . . . . . .
"4576" "4562" "4591" "4503" "4673" "5459" . . . . . .
"5459" "4562" "9671" "540" "4319" "0017" . . . . . .
"4531" "5459" "4513" "403" "5351" "5472" . . . . . .
"4562" "9915" "5459" "4591" "5361" "8674" . . . . . .
"544" "4562" "8332" "4591" "5497" "9925" . . . . . .
"3897" "4562" "5412" "5459" "4593" "4673" . . . . . .
"4576" "4575" "4562" "4594" "4521" "6549" . . . . . .
"4573" "4709" "5012" "3893" "544" "5349" . . . . . .
"4863" "4591" "4011" "4562" "4823" "598" . . . . . .
"6561" "4029" "544" "4620" "4709" "4869" . . . . . .
"4562" "5459" "4651" "3893" "5361" "4579" . . . . . .
"4571" "5421" "6539" "4571" "4593" "4562" . . . . . .
"4652" "4620" "4562" "543" "5459" "9977" . . . . . .
"4562" "4673" "9915" "8847" "4513" "3893" . . . . . .
"4562" "6561" "543" "5459" "4719" "3897" . . . . . .
"6561" "6849" "4573" "4562" "4541" "3893" . . . . . .
"544" "704" "403" "4709" "4601" "4863" . . . . . .
"4573" "4562" "4011" "5682" "586" "598" . . . . . .
"4875" "4576" "4594" "4562" "7077" "5459" . . . . . .
"4709" "4562" "9671" "5459" "4579" "4593" . . . . . .
"5411" "3897" "9390" "9604" "9671" "9915" . . . . . .
"3979" "5411" "8847" "5717" "7902" "9659" . . . . . .
"3527" "3774" "3961" "9604" "9671" "3783" . . . . . .
"5411" "311" "3950" "3990" "0045" "0040" . . . . . .
"3241" "1745" "3323" "3423" "3897" "9672" . . . . . .
"3925" "9671" "4582" "4623" "3818" "9604" . . . . . .
"6849" "6529" "6549" "5459" "5719" "543" . . . . . .
"741" "7552" "6849" "5412" "5732" "9907" . . . . . .
I am new to stata, I need help with the following
I have a list of procedural codes attached below. I want to search from variables PR1-PR6 for the presence of these, and then check PRDAY1 to PRDAY6 for the presence of zero. So basically PR1 is matched with PRDAY1, PR2 is matched with PRDAY2, etc. A case is included if it has the code for the selected procedure in Var PR1-PR6 and zeroes in the corresponding match Var PRDAY. Below is an example.
Search PR1-PR6 for any of these codes 3511, 3521, 3522, and compute to a new VAR- Aortic valve replacement (AVR) If the corresponding PRDAY is 0 when the code is detected. For instance, a case will be 1 for the AVR variable if PR1 has any of the codes (3511, 3521, 3522) and PRDAY1 is 0. Below is the example dataset, and the list of codes I am searching for. I look forward to any assistance with cheerful optimism.
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input str7(PR1 PR2 PR3 PR4 PR5 PR6) double(PRDAY1 PRDAY2 PRDAY3 PRDAY4 PRDAY5 PRDAY6)
"4562" "4591" "4611" "9904" "9915" "9604" . . . . . .
"4562" "5459" "4593" "5491" "9915" "3897" . . . . . .
"4562" "539" "4673" "3324" "9672" "9604" . . . . . .
"5471" "4562" "4593" "4319" "3897" "3894" . . . . . .
"4652" "4562" "5641" "5451" "5459" "8605" . . . . . .
"4389" "4591" "5491" "3323" "9907" "3897" . . . . . .
"540" "4562" "4679" "4679" "5412" "5412" . . . . . .
"4562" "9672" "5459" "9356" "9604" "3891" . . . . . .
"4562" "4591" "3991" "5423" "4011" "4513" . . . . . .
"6651" "6529" "4562" "4673" "4709" "5459" . . . . . .
"4562" "9915" "5459" "4719" "9904" "3893" . . . . . .
"4573" "4562" "4593" "544" "598" "4525" . . . . . .
"4389" "4591" "4551" "5014" "5123" "4701" . . . . . .
"4551" "8015" "5411" "4593" "8045" "8085" . . . . . .
"4399" "4562" "5459" "4513" "3404" "1771" . . . . . .
"3897" "4438" "4591" "4711" "5123" "5371" . . . . . .
"6841" "6563" "5451" "4562" "5900" "1742" . . . . . .
"4562" "688" "704" "576" "5781" "562" . . . . . .
"741" "6632" "5411" "5459" "4562" "7309" . . . . . .
"5252" "9672" "4562" "5495" "283" "8919" . . . . . .
"3482" "7936" "7937" "5475" "4562" "4675" . . . . . .
"4562" "4709" "5841" "6449" "5822" "4823" . . . . . .
"4652" "4673" "4562" "5459" "4591" "5459" . . . . . .
"6919" "6829" "5902" "4719" "6539" "4562" . . . . . .
"4576" "4562" "4591" "4503" "4673" "5459" . . . . . .
"5459" "4562" "9671" "540" "4319" "0017" . . . . . .
"4531" "5459" "4513" "403" "5351" "5472" . . . . . .
"4562" "9915" "5459" "4591" "5361" "8674" . . . . . .
"544" "4562" "8332" "4591" "5497" "9925" . . . . . .
"3897" "4562" "5412" "5459" "4593" "4673" . . . . . .
"4576" "4575" "4562" "4594" "4521" "6549" . . . . . .
"4573" "4709" "5012" "3893" "544" "5349" . . . . . .
"4863" "4591" "4011" "4562" "4823" "598" . . . . . .
"6561" "4029" "544" "4620" "4709" "4869" . . . . . .
"4562" "5459" "4651" "3893" "5361" "4579" . . . . . .
"4571" "5421" "6539" "4571" "4593" "4562" . . . . . .
"4652" "4620" "4562" "543" "5459" "9977" . . . . . .
"4562" "4673" "9915" "8847" "4513" "3893" . . . . . .
"4562" "6561" "543" "5459" "4719" "3897" . . . . . .
"6561" "6849" "4573" "4562" "4541" "3893" . . . . . .
"544" "704" "403" "4709" "4601" "4863" . . . . . .
"4573" "4562" "4011" "5682" "586" "598" . . . . . .
"4875" "4576" "4594" "4562" "7077" "5459" . . . . . .
"4709" "4562" "9671" "5459" "4579" "4593" . . . . . .
"5411" "3897" "9390" "9604" "9671" "9915" . . . . . .
"3979" "5411" "8847" "5717" "7902" "9659" . . . . . .
"3527" "3774" "3961" "9604" "9671" "3783" . . . . . .
"5411" "311" "3950" "3990" "0045" "0040" . . . . . .
"3241" "1745" "3323" "3423" "3897" "9672" . . . . . .
"3925" "9671" "4582" "4623" "3818" "9604" . . . . . .
"6849" "6529" "6549" "5459" "5719" "543" . . . . . .
"741" "7552" "6849" "5412" "5732" "9907" . . . . . .
| Procedure | ICD-9 Procedure Codes |
| Abdominal aortic aneurysm repair | 3864, 3834, 3844 |
| Above knee amputation | 8417 |
| Aortic valve replacement | 3511, 3521, 3522 |
| Carotid endarterectomy | 3812 |
| Colon resection | 1731, 1732, 1733, 1734, 1735, 1736 1739, 4503, 4526, 4541, 4549, 4552 |
| Coronary artery bypass | 3511, 3512, 3513, 3514, 3516, 3517, 3518, 3519, 3520, 3521, 3522, 3523, 3524, 3535, 3536, 3527, 3528, 3529, 3610. 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619 |
| Cystectomy | 5779, 576, 5771 |
| Esophagectomy | 4240, 4241, 4242 |
| Exploratory laparotomy | 5411, 5412, 5419 |
| Gastrectomy | 435, 436, 437, 437, 4381, 4389, 4391, 4399 |
| Liver resection | 5022, 503, 504 |
| Lower extremity bypass | 3925, 3929 |
| Lung lobectomy | 3241, 3249 |
| Mitral valve replacement | 3523, 3524 |
| Nephrectomy | 554, 5552, 5554 |
| Pancreatectomy | 5251, 5252, 5253, 5259, 526, 527 |
| Pneumonectomy | 325, 3250, 3259 |
| Rectal resection | 4852, 4859, 4861, 4862, 4863, 4864, 4869 |
| Small bowel resection | 4531 - 4534, 4551, 4561, 4562, 4563, 4591, 4602 |

Comment