# Creating unique identifier

**URL:** <https://forum.ipums.org/t/creating-unique-identifier/1598>\
**Category:** CPS\
**Created:** [February 20, 2017, 2:42pm UTC](https://forum.ipums.org/t/creating-unique-identifier/1598 "2017-02-20T14:42:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lexlh4](https://avatars.discourse-cdn.com/v4/letter/l/3be4f8/32.png) [@lexlh4](https://forum.ipums.org/u/lexlh4)\
**Post date:** [February 20, 2017, 2:42pm UTC](https://forum.ipums.org/t/creating-unique-identifier/1598/1 "2017-02-20T14:42:00Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![JeffBloem](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.ipums.org/jeffbloem/32/40_2.png) [@JeffBloem](https://forum.ipums.org/u/JeffBloem)\
**Post date:** [February 20, 2017, 3:17pm UTC](https://forum.ipums.org/t/creating-unique-identifier/1598/2 "2017-02-20T15:17:00Z")

</div>

This issue likely arrises when you are trying to create a unique identifier across CPS samples. Both [SERIAL](mailto:lah39@le.ac.uk) and [PERNUM](https://cps.ipums.org/cps-action/variables/PERNUM#codes_section) uniquely identify households and persons within those households within a given survey month and year - not across years.

[CPSIDP](https://cps.ipums.org/cps-action/variables/CPSIDP#description_section) 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](https://cps.ipums.org/cps-action/variables/LINENO#codes_section)) 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](https://cps.ipums.org/cps/resources/linking/4.workingpaper16.pdf).

I hope this is helpful.
