SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Creating flags to measure differences in episodes of hospital readmissions

Reply
Occasional Contributor
Posts: 8

Creating flags to measure differences in episodes of hospital readmissions

 

I would like to create a flag to indicate readmission episodes. I started by using SQL to identify all persons in a data set where the difference between their admission (ADMD) and discharge (DISD) dates were between 1 and 30. The resulting data set generated a flag for readmits (Read_Flag) . I then used that information to transpose the Read_Flag by patient:

 

 

proc transpose data=all.readmits4 out=all.reflag_wide prefix=Read_Flag;
by uidnum ;
var Read_Flag;
run;

 

data all.NEW_reflag; 
merge all.reflag_wide all.readmits4a;
by uidnum;
run;

 

proc sort data=all.NEW_reflag nodups; 
by uidnum;
run;

 

data all.NEW_reflag2;
set all.NEW_reflag;
rename Read_Flag1 = index;
run;

 

Everything is ok until I get here:

 

data all.NEW_reflag2;
if index (DISD) - Read_Flag2 (ADMD) >= 30 then RDMT1 =1;
else RDMT1=0;
if if Read_Flag2 (DISD) - Read_Flag3 (ADMD) >= 30 then RDMT2 =1;
else RDMT2=0;
run;

 

Again, I would like to create a flag to indicate readmission episodes (Read_Flag 1 through  Read_Flag 1894) that are more than 30 days apart (with a RDMT flag). I tired the code above however I get a lot of syntax error issues from SAS, plus I'm not sure if I can subtract that the discharge date from one variable with the admission date of another variable. Please advise on the most efficient way to address this issue, Thanks:

Super User
Posts: 10,454

Re: Creating flags to measure differences in episodes of hospital readmissions

 

If you want to search a string with the index function you need both a source string and target string.

I have no idea what you may be attempting to do here:

if index (DISD) - Read_Flag2 (ADMD) >= 30 then RDMT1 =1;

Read_flag1(ADMD) will mean absolutely nothing to SAS.

If you want to compare the postions of strings you'll need to provide 1) the name of the variable and 2) the value to search for in that variable. It  looks like you may want

 

if index(index,'DISD') - index(Read_flag2,'ADMD') ge 30 then RDMT1=1;

Assuming you meant to search for the string value 'DISD' inside the variable Index and 'ADMD' inside the variable Read_flag2.

 

You may want to consider:

data all.NEW_reflag2;
    set all.NEW_reflag (rename=(Read_Flag1 = index));

 

Occasional Contributor
Posts: 8

Re: Creating flags to measure differences in episodes of hospital readmissions

I will try this,
My goal was to subtract the discharge date (DISD) of my index variable fom the admission (ADMD)date of my Read_flag2 variable.
Does that change your suggestion?
Super User
Posts: 10,454

Re: Creating flags to measure differences in episodes of hospital readmissions

It really helps to provide some data. How do we know what the discharge date of your index variable is? Or the admission date of the Read_flag2? Are they even SAS date values, character or some other numeric that looks vaguely date like.

 

You can use the instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... to create data step code of your All.New_reflag dataset so we can test data against it. But you may still need to tell use how to identify DISD and ADMD.

 

Ask a Question
Discussion stats
  • 3 replies
  • 221 views
  • 0 likes
  • 2 in conversation