Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 26 Jun 2013 @ 22:58:39 GMT


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  


Subj:   Compare Fields in Separate Records
 
From:   Jerry.R.Fleury

Is there a method or solution to compare the date in one record to the date in another record and provide a result based on the comparison?

e.g., in below matrix when record 2 admit_date (1/3/13) is between record1 disch_date+1 and disch_date+30 then Y else N end

I have strung out the data and was able to easily make the comparison.

For example

     admit_date1       disch_date1       admit_date2        disch_date2
     12/20/2012        12/22/2012        1/3/2013           1/6/2013

Comparing disch_date1 to admit_date2 such that admit date was within 30 days of discharge is a y

However, the challenge is to format the data in a friendly format for analysis. Stringing out the data based on patient rather than presenting data by encounter record makes the analysis very cumbersome as there may be up to eight discharges per patient within the requested date range. There are 15000+ patients in the cohort.

Ideally for analysis the data set would look like this:

     record   pt       admit_date        disch_date       y/n
     1        A        12/20/2012        12/22/2012        n
     2        A        1/3/2013          1/6/2013          y
     3        A        3/1/2013          3/3/2013          n
     4        A        4/5/2013          4/6/2013          n
     5        B        2/28/2013         3/4/2013          n
     6        B        3/27/2013         4/4/2013          y
     7        B        4/5/2013          4/8/2013          y

best wishes,

jerry

Gerald "Jerry" Fleury
Decision Support
South Bay Medical Center



     
  <Prev Next>  
<<First
<Prev
Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023