Dear SAS New User, Please can help with this problem, it trying to detect and enumerate drops in relative humidity (RH) by geographical location. The drop needs enumerating for later analysis. Defining drop in RH follows rules: 1) to be a drop in RH it must have 3 consecutive datapoint in humidity below a threshold (less than or equal 30%). 2) The drop in humidity finishes stop if there are 3 consecutive points above threshold (31% and above). 3) Then on the next started drop (within that location), it labels drop as +1. See data I given. Very grateful for help! I try retain and count but I never manage.
datetime
loc
RH (%)
RH drop number
21NOV20:00:59
a
33
.
21NOV20:01:04
a
31
.
21NOV20:01:09
a
30
.
21NOV20:01:14
a
30
.
21NOV20:01:19
a
29
1
21NOV20:01:24
a
28
1
21NOV20:01:29
a
27
1
21NOV20:01:34
a
27
1
21NOV20:01:39
a
27
1
21NOV20:01:44
a
26
1
21NOV20:01:49
a
28
1
21NOV20:01:54
a
27
1
21NOV20:01:59
a
26
1
21NOV20:02:04
a
25
1
21NOV20:02:09
a
24
1
21NOV20:02:14
a
23
1
21NOV20:02:19
a
21
1
21NOV20:02:24
a
22
1
21NOV20:02:29
a
18
1
21NOV20:02:34
a
20
1
21NOV20:02:39
a
27
1
21NOV20:02:44
a
29
1
21NOV20:02:49
a
32
.
21NOV20:02:54
a
31
.
21NOV20:02:59
a
32
.
21NOV20:03:04
a
29
.
21NOV20:03:09
a
29
.
21NOV20:03:14
a
29
2
21NOV20:03:19
a
28
2
21NOV20:03:24
a
28
2
21NOV20:03:29
a
29
2
21NOV20:03:34
a
28
2
... View more