Merging with unique personids but not sorted as unique in datasets

Hi Everyone-

First, long time viewer of the forum but first time posting. Thank you so much for any advice, this site has helped get me back on track with several assignments in the past, and I really appreciate all of the comments and time spent by contributors.

I am attempting to merge multiple datasets for the same year of MEPS (Medical Expenditures Panel Survey) data. The unique identifier is/should be DUPERSID, basically a personid variable. My problem is that in several of the data sets, for example sets involving medical conditions, each condition is listed and associated separately with the DUPERSID. So, there is a row for 'jay85' with diabetes, and a 'jay85' with mobility issues, etc. It is the same 'jay85', however, I obviously am unable to combine datasets using that personid variable because it is not unique in its current form.

Could someone please advice how to modify the files to each DUPERSID is unique and ready to merge?

Any advice and tips would really be helpful, and thanks for any thoughts or suggestions were I could look.
Depending on what your exact needs are, you're probably looking for "one-to-many" and "many-to-one" merges. The help file for -merge- explains how to implement them with examples (-h merge-). You may also benefit from reading up on how to -collapse- and -reshape- data sets in Stata.