Hello @DavidsM,
You're welcome. I'm happy that I could help you.
The solution disregarding the extra rule about the last event is exactly that in my earlier post. To check this assertion, you can compare the result of that shorter data step (using a large input dataset HAVE) with the result of the extended data step, but with one line commented out (and, of course, a different output dataset name, e.g. WANT0):
*if date=evdate_last & event then new_event=1;
PROC COMPARE should then confirm the equality of WANT and WANT0.
Please note that the shorter data step is more efficient than the extended one because for the extra rule (whether applied or not, i.e. with the above IF/THEN statement active or commented out) I used a second SET statement, i.e., dataset HAVE is read twice.
I am really so grateful for your assistance. Just so grateful and so thankful to you FreelanceReinhard.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.