Hi, I have a huge dataset (n=12000) with variables of interest: date and cholesterol level. For each date, there can be multiple cholesterol measurements from different participants. For example:

Date Cholesterol
24/8/2018 116.4
24/8/2018 120.5
24/8/2018. 118.5
27/8/2018. 130.7
27/8/2018. 135.8
28/8/2018. 129.8

Due to the large number of observations, I have derived average of cholesterol by batch of 100 (Y-axis) and plotted this against the Median (Date) of this batch of 100 (X-axis). Below are my code:

seq batch, f(1) t(120) b(100)
egen cholesterol_batch100 = mean (Cholesterol), by (batch)
egen median_date= median (Date), by (batch)
format median_date %td


***My question is how do I write a code to identify, say 8 consecutive points that are below the mean value of the cholesterol level. For example, the calculated average value of cholesterol for n=12000 is 140. How do I pick up a trend of 8 consecutive points measured on consecutive dates (ie. 24/8/2018, 27/8/2018/, 28/8/2018 , etc) that are below this value? I don't even know where to start. Hope to get some advice. Many thanks!