Lag Function in SAS

I am trying to get the previous value of a specific column based on unique identifiers. Please see the example. The calculation should be “start date - end date from previous period”. If it is the first period for that specific ID, then the end date from the previous period should be set equal to the default date. The dataset has multiple IDs.

Read more here:

Content Attribution

This content was originally published by j12345 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: