BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
FreelanceReinh
Jade | Level 19

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.

DavidsM
Calcite | Level 5

 

I am really so grateful for your assistance. Just so grateful and so thankful to you FreelanceReinhard. 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 16 replies
  • 2358 views
  • 2 likes
  • 3 in conversation