In building a Stata panel set from a CRSP/Compustat merged (CCM) data extract, you may receive an error message: 'repeated time values within panel'.
Duplicates can appear from many different sources and you should be careful applying a step such as 'duplicates drop'. (SAS has something similar with PROC SORT NODUP). It may not be doing exactly what you want.
In these cases, it is best to sort the data by the CompanyID-Date variables and look for repeats in the pair. Each repeat may need to be handled differently.
With a CCM query, you can get duplicates of GVKEY observations depending on the options selected as some GVKEYs have multiple potential PERMNOs in a year or quarter. Try using LPERMNO as the Panel ID to see if this removes the error message. (Even if PERMNO is not the right concept as it corresponds to a security and not a company -- just run as a test).