Hi all, I have difficulty designing my program. In my data set, I have hundreds of patients. Each patient is recorded with his/her blood pressure, and these records are ordered by hour. What I am trying to do is that if the the difference between starting time and current time is greater than 24 hour, then record should switch to another day. It's a bit too abstract, so allow me to present an example: OBS ID SBP Hour 1 1 115 15 2 1 113 17 3 1 121 23 4 1 120 0 5 1 112 5 6 1 108 13 7 1 110 15 8 1 113 16 9 1 115 17 10 1 113 18 11 1 121 23 12 1 120 0 13 1 112 5 14 1 108 13 15 1 110 15 16 1 113 16 I want to add a variable "Day", and the value is 1, for OBS=1 to 6 2, for OBS=7 to 14 (Since time at 7th-OBS equals time at 1st-OBS, it means this monitoring device has started over 24 hour, so the variable "Day" should added one) 3, for OBS=15 16 (Since it's the second time that the time at nth-OBS equals the time at 1st-OBS, it means this monitoring device has started over 24*2 hour, so the variable "Day" should added two) Regarding this question, on one hand, I post it here hope someone can save me from the mud. On the other hand, I'm searching information about "do-loop in SAS". If anyone has any idea, I'll appreciate it. Thanks in advance! Best, Bill
... View more