I have a data set similar to the following simple data set. With the four column of Account, Date, Time and ID, I like to using SAS macro to create a column like "HIT" with 0 and 1 value. The logic is " there is more than 1 of ID used within 2 days from the same account." If the logic is satisfied, then the variable HIT is 1, else is 0.
1. Do you have to have a macro or will a datastep or Proc SQL work?
2. How are you defining hit exactly? maybe I'm missing something but it doesn't look like 48 hours between ids in the sample data set.
I believe what Ksharp's code - with the little glitch -nicely demonstrates is that before you try and solve something with a macro you first get the code right for one of your cases - and only then generalise it via a macro.
Also: If performance should become an issue AND the source tables are in SAS then a "hash approach" would perform better - but the code would also become quite a bit more complicated.