HI all,

I have a dataset in long-format and would like to drop information so that I can just keep the lines in which I have data for each participant. The LopNr is the ID of the participant and the other important variables for me is the skadedate. For other viarbales (del_fom_date) each participant has 225 occurrences of an event, in long-format, since one of the participants has that number of sick leave spells during the follow-up. I just can't get the logic of how to drop the occurrences of individual who does not have any information in it without loosing the information for those who have it. Some participants do not have any sick leave, like case 4. but I do want to keep case 4 in for comparison of those who have sickleave and those who don't.

To make it clear, if a person has one sick leave spell, I want to keep 1 occurrent for that person but not all 225, some people might have 10 occurrences of sick leave and then I want to keep all of the 10 but not the rest of the 215, and for the person who has no sick leave I want to keep the first row but not the other 224 rows. Anyone with a smart solution?

Array Array