Hello. I have a folder with about 50 data files. I want to merge the files either on 1 or 2 variables depending on if the data contains one or both of these variables. I have to repeat this process for about 10 different folders. Therefore, I would not like to open up each file and see which merging variables the file contains.

Also it is possible that a few files may have missing observations for the merging variables and would result in stata telling me the merging variables do not uniquely identify observations. I want to avoid checking each file and deleting these missing observations.

Any suggestions would be greatly appreciated! Thanks.

Amit