How to include ranges in SAS/SQL

Reply
Occasional Contributor
Posts: 9

How to include ranges in SAS/SQL

I'm trying to figure out how to include particular CPT codes and ICD-9 codes

I want at least one match from both CPT and ICD-9

Some ICD-9's will have a 4th or 5th digit, only the 1st 3 are shown.

CPT

ICD-9 (first 3 characters, some are 4 digits and some are 5 digits)

78300-78399V17
20982-20999V13
21310-21499738
22900-22999754
22548-22634756
23395-23491781
24300-24498729
20200-20206306
20240-20251905
20500-20501723
Trusted Advisor
Posts: 1,228

Re: How to include ranges in SAS/SQL

Which one of the above observations will be in the desired output?

Occasional Contributor
Posts: 9

Re: How to include ranges in SAS/SQL

Not sure, basically I want to look at members that have had at least one procedure (CPT) AND one diagnosis (ICD-9)

Trusted Advisor
Posts: 1,228

Re: How to include ranges in SAS/SQL

How it would be determined that a member has at least one CPT and one ICD-9 based on the given data?

Occasional Contributor
Posts: 9

Re: How to include ranges in SAS/SQL

We would look at a claims table to see the CPT and ICD-9 code from the claim.

so an example would be

Select *

from abc_claim_table

where ......

I'm trying to lump about 40-60 CPT Code Ranges and ICD-9 Ranges to determine which claims match both a CPT and ICD-9 Criteria.

Trusted Advisor
Posts: 1,228

Re: How to include ranges in SAS/SQL

How about this?

proc sql;

select * from abc_claim_table

where findc(icd9,cpt,'i')>0;

quit;

Regular Contributor
Posts: 217

Re: How to include ranges in SAS/SQL

Hi,

In 2004 I produced code that matched cpt codes and ICD-9 codes.  I'm assuming you want to convert the ICD-9 codes to ICD-10 codes. Essentially I built a massive format that listed all the valid cpt/icd9 combinations.  Not all combinations are significant.  Then I built arrays to hold the codes during the program process.  Then I searched each array member by format result.  When the cpt(i) and icd(i) values were significant, for the data row, I set a flag.  In my case, a row was significant if any flag value was significant.  On a smaller scale you could build a flag array and populate flg(i) whenever cpt(i) and icd(i) were significant.  The hard part was setting up the siginificant combinations.  Fortunately, formats allow the use of ranges.

Also, arrays and formats allow you to check cpt(i) for all values in the icd array.  do i=1 to ...;

                                                                                                                           do j=1 to ....;

                                                                                                                                 if cpt(i) format = icd(j) format then flag(i) = flag value.

                                                                                                                           end;

                                                                                                                    end;

Ask a Question
Discussion stats
  • 6 replies
  • 550 views
  • 0 likes
  • 3 in conversation