08-11-2014 10:04 PM
Hello SAS Users,
I'd like some help setting up a table for analysis. Currently the table looks like the one immediately below:
Each ID is associated with an ENTRY and EXIT time, which are bounded by LEFT and RIGHT limits. The ID's status will vary in each interval. Now, I'd like to arrange the data so that FOR EACH ID, I only have one set of unique left and right values. For instance, for ID = B, the first three lines have left = 0 and right = 0.5. I don't really care about the subintervals between the left and right limits of 0 and 0.5. However, for the last listing of left = 0 and right = 0.5, I want to preserve the value of the STATUS variable. For the 4th line (ID = A, Status = 1, Entry = 0.5, and Exit = 0.67077), I want to keep it as is because the EXIT value never reached the RIGHT value. I've created a table below the first to show what I would like to achieve.
This is the table I want:
Thanks for your help!
08-11-2014 11:25 PM
proc sort data=input;by id left right; run;
by id left right;
if first.left then temp_entry=entry;
if last.left and last.right then do;