"lag" command in merging files

I am in the process of merging two data sets. The one that I am trying to merge into my original file has multiple lines of data, each representing a different event that happened to the person/case. I have successfully been able to merge the first of each line of data, but now need to incorporate the other lines per each individual as well. I have asked others for help, and they have directed me to use the "lag" command, but I cannot find more specific instructions or helpful links. If anyone has any help they can provide, I appreciate it!

To illustrate, the data set I want to merge looks like this:

Case # Event #
1 1
1 2
1 3

And I have successfully merged Event #1 for Case #1, but how do I merge Events #2 and 3 using "lag"? Thanks!