BookmarkSubscribeRSS Feed
Marilyn
Calcite | Level 5
Does someone already have some generic code that will pull patients with several ranges of diagnoses from a file that records up to 10 diagnoses at a time?
i.e. I want to pull any patient that had dx 345.00-345.99, or 346.0-346.9, or 296.0-296.9 from multiple years...
6 REPLIES 6
LinusH
Tourmaline | Level 20
I don't have any generic code, but it will help to give some hints if you could show the record lay-out, and some sample data.

/Linus
Data never sleeps
Marilyn
Calcite | Level 5
There's just generic information like name, ssn, diag1 - diag10, DOV, etc...
Doc_Duke
Rhodochrosite | Level 12
No code, but some comments. This looks like Medicare billing data since there is a limit of 10 diagnoses. The size of some of these datasets can be huge, so some approaches (like TRANSPOSE) that are effective for smaller datasets run out of computer resources with larger ones.

ICD codes are character strings, not numbers, so trying to specify a range is tricky (e.g. ICD 345.1 is different from ICD 345.10). If you are just interested in the summary at the first three digits, use the SUBSTR function or the =: operator for the comparison, e.g.
IF diag1 =: '345' | diag1=:'346'...
or
SELECT ...
WHERE substr(diag1,1,3) IN ('345', '346', '296') | ...
Marilyn
Calcite | Level 5
yes...this works quite well.
Now I am working on trying to make an array of the diagnosis codes...
deleted_user
Not applicable
try the following where clause through an sql query:

where
(Diag_Code___Prin between '001' and '00999'
or Diag_Code___Prin between '033' and '03399'
or Diag_Code___Prin in ('V016','V027','V028')

or Diag_Code___Secondary_1 between '001' and '00999'
or Diag_Code___Secondary_1 between '033' and '03399'
or Diag_Code___Secondary_1 in ('V016','V027','V028')

or Diag_Code___Secondary_2 between '001' and '00999'
or Diag_Code___Secondary_2 between '033' and '03399'
or Diag_Code___Secondary_2 in ('V016','V027','V028'))
shellp55
Quartz | Level 8
Hi

Actually I have a similar type format for diagnoses (except it goes to 25) and I create the array of:

array diagcde[25] $ diagcde1-diagcde25;

Then when searching for specific codes I indicate:

do i=1 to 25 until (diagcde = ' ');
if diagcde in substr(diagcde,1,3) in ("C00","C01") then .

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

New Learning Events in April

 

Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.

LEARN MORE

Discussion stats
  • 6 replies
  • 1352 views
  • 0 likes
  • 5 in conversation