SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
Guptashwe
Calcite | Level 5

Cough is identified using ICD-9/10 codes from the claims databases. Whereas, there is no ICD-9/10
code available to define the chronic stage of cough. The objective of the problem is to identify
patients who have been diagnosed with chronic cough between 2007 and 2009. These patients will
be then assessed for their demographic characteristics. The following algorithm is deigned to
identify chronic cough patients:
A patient having at least three inpatient/outpatient claims for cough within the time window of 120
days anytime, between 2007 and 2009.
The following dataset has patients with service dates for cough from 2007 and 2009. Identify
patients diagnosed with chronic cough between 2007 and 2009.

 

Problem 2.jpg

4 REPLIES 4
Guptashwe
Calcite | Level 5
i have attached the bat file.
Guptashwe
Calcite | Level 5
 
Astounding
PROC Star

Assuming that your data already embodies much of the work that needs to be done:

 

  • The observations include only cough-related observations
  • The observations are already subset for the years 2007 through 2009
  • The observations are in order by ENROLID SVCDATE

 

All that remains is to identify patients that have 3 observations within a 120-day window.  Here is an approach to do that:

 

data want;

id_counter=0;

chronic='N';

do until (last.enrolid);

   set have;

   by enrolid svcdate;

   id_counter + 1;

   if dif2(svcdate) <= 120 and id_counter >= 3 then chronic='Y';

end;

do until (last.enrolid);

   set have;

   by enrolid;

   output;

end;

drop id_counter;

run;

 

The top loop processes observations for one ENROLID, setting CHRONIC to Y or N.  The bottom loop processes the same observations, outputting them with the assigned value for CHRONIC.

sas-innovate-white.png

Join us for our biggest event of the year!

Four days of inspiring keynotes, product reveals, hands-on learning opportunities, deep-dive demos, and peer-led breakouts. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1083 views
  • 0 likes
  • 3 in conversation