For this I have already looked at the posts in the community, but they seemed to not serve my purpose. I tried the following code, which did not work.
data zzz;
set yyy;
by return notsorted;
if Day= "Sun" and first.return then delete;
run;
I have the following table:
Date Time Day Return
03/05 12:20 Sun 2.45
03/05 12:30 Sun 3.23
03/05 12:35 Sun 2.03
03/05 12:40 Sun 2.55
03/05 12:45 Sun 3.11
03/05 12:50 Sun 2.67
03/06 12:25 Mon 2.99
03/06 12:30 Mon 3.09
03/06 12:35 Mon 2.05
03/06 12:40 Mon 2.61
03/06 12:45 Mon 3.32
03/06 12:50 Mon 2.39
...
...
...
03/12 12:20 Sun 2.92
03/12 12:30 Sun 3.13
03/12 12:35 Sun 2.63
03/12 12:40 Sun 2.15
03/12 12:45 Sun 3.51
03/12 12:50 Sun 2.57
I want to delete the first observation of each Sunday. What was wrong with my code? A lot more than expected rows got deleted. 52 Sundays in a year times 12 years = 624 observations are supposed to be deleted.