Creating unique identifier

I am trying to create a unique ID however I am getting duplicates. I am using the code,

egen uniqueid = group(pernum serial)

any reason why this is the case of a solution would help!

This issue likely arrises when you are trying to create a unique identifier across CPS samples. Both SERIAL and PERNUM uniquely identify households and persons within those households within a given survey month and year - not across years.

CPSIDP is an IPUMS-CPS defined variable that uniquely identifies individuals across CPS samples. The first six digits of CPSIDP index the four-digit year and two-digit month that the household was first in the CPS. CPSIDP allows users to link a respondent appearing with a designated household roster line number (LINENO) across samples, based on the 4-8-4 rotation pattern, by assigning a unique CPSIDP value to this line number. More information about linking households and individuals across CPS samples is available in this working paper.

I hope this is helpful.