Help using Base SAS procedures

multiple filter procedure

Posts: 23

multiple filter procedure

The attached sports2 file contains info about sport events.

KDate is the actual date of the match. Ktime is the starting time of the match. Win and Loss are dummy variables. I have to filer the data by a couple criteria:

1. if the match time (Ktime) is before 7am, then set date=kdate, otherwise, set date=kdate+1. Let's say a soccer match starts at 3pm on 1/1 (kdate), then date=1/2. I've done this part.

if hour(KTIME) < 7 then KDATE1=KDATE;

if hour(KTIME) >= 7 then KDATE1=KDATE+1;            

2.If a trading day with a game played during trading hours (9am-4pm) is matched with other game(s) carried forward from yesterday, remove both games. For instance, a soccer match starts at 3pm on 1/1 (kdate), then date=1/2. If on 1/2, there is baseball game at 2pm (by rule 1, date= 1/3), then delete both matches.

3.if there are two matches on the same date (not kdate) and if the results are the same, then combine them as one event. Otherwise (like 1 win and 1 loss), delete all observations on the same date.


Ask a Question
Discussion stats
  • 0 replies
  • 1 in conversation