This discussion is archived
1 Reply Latest reply: Nov 6, 2012 3:46 AM by 972760 RSS

Code Assistance Needed

972048 Newbie
Currently Being Moderated
I am pretty new to writing codes and I am hoping that someone can help. I feel that I am just missing something simple, but I can not get my code to work properly.

I am trying to pull data from an oracle table (Connecting through SAS). It contains Person ID, Status, Start Time, End Time and Last Date/time Updated. The problem i am having is that for each person/day the data is loaded 7 times, there could be 50+ records per day and the start time or end time could change each time the data is updated. I need to pull all the records based on the last day updated and return person ID, status, start time, end time and update date.

Below is a sample of the data - I have put a space between where the LAST_LD_TS (Last Date/Time Updated) changes days. I would like to return just the last set (Last Date Updated regardless of time of that day).

ANY assistance would be appreciated.

PERSON_ID     STATUS     START_TIME     END_TIME     LAST_LD_TS
2751     ADHERENT     1/2/12 0:00     1/2/12 16:00     1/3/12 3:47
2751     NON_ADHERENT     1/2/12 16:00     1/2/12 16:01     1/3/12 3:47
2751     ADHERENT 1/2/12 16:01     1/2/12 16:02     1/3/12 3:47
2751     ADHERENT     1/2/12 16:02     1/2/12 16:03     1/3/12 3:47
2751     ADHERENT     1/2/12 16:03     1/2/12 16:11     1/3/12 3:47
2751     ADHERENT     1/2/12 16:11     1/2/12 16:12     1/3/12 3:47
2751     ADHERENT     1/2/12 16:12     1/2/12 16:16     1/3/12 3:47
2751     NON_ADHERENT     1/2/12 16:16     1/2/12 16:17     1/3/12 3:47
2751     ADHERENT     1/2/12 16:17     1/2/12 16:36     1/3/12 3:47
                    
2751     ADHERENT     1/2/12 0:00     1/2/12 16:00     1/4/12 3:50
2751     NON_ADHERENT     1/2/12 16:00     1/2/12 16:05     1/4/12 3:50
2751     ADHERENT     1/2/12 16:05     1/2/12 16:11     1/4/12 3:50
2751     ADHERENT     1/2/12 16:11     1/2/12 16:12     1/4/12 3:50
2751     NON_ADHERENT     1/2/12 16:12     1/2/12 16:16     1/4/12 3:50
2751     ADHERENT     1/2/12 16:16     1/2/12 16:17     1/4/12 3:50
2751     ADHERENT     1/2/12 16:17     1/2/12 16:36     1/4/12 3:50
                    
2751     ADHERENT     1/2/12 0:00     1/2/12 16:00     1/5/12 3:50
2751     NON_ADHERENT 1/2/12 16:00     1/2/12 16:05     1/5/12 3:50
2751     ADHERENT     1/2/12 16:05     1/2/12 16:11     1/5/12 3:50
2751     ADHERENT     1/2/12 16:11     1/2/12 16:12     1/5/12 3:51
2751     NON_ADHERENT 1/2/12 16:12     1/2/12 16:16     1/5/12 3:51
2751     ADHERENT     1/2/12 16:16     1/2/12 16:17     1/5/12 3:52
2751     ADHERENT     1/2/12 16:17     1/2/12 16:26     1/5/12 3:52
2751     NON_ADHERENT 1/2/12 16:26     1/2/12 16:30     1/5/12 3:52
2751     ADHERENT     1/2/12 16:30     1/2/12 16:36     1/5/12 3:52

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points