Hello

I have a dataset in which each identifier (ID) has multiple rows of observations, ranging from 2 to 15.
I have a variable (main), the answer to which determines whether or not the row will be considered in all analysis (1 means "Yes"). This could be 1 or multiple rows per ID.
I have one row of observation per ID, which has answers to variables different from the rest. I want to merge this row of observation with row(s) which has "Yes" for the variable main.

I don´t seem to get any command work for that so far. I would appreciate any help. Let me know if further clarification is required.

Thank you.