Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: create a unique identifier from a few variables


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: create a unique identifier from a few variables
Date   Thu, 15 Jan 2004 19:34:18 -0000

You could try -egen, concat()- or -egen, group()-.

The first has the advantage that all the information
is explicit and the disadvantage that the composite
variable has lengthy values and is awkward to handle.
With your variables you would need a version of Stata
allowing long enough string variables, i.e. Stata/SE.

The second has the opposite features.

See also
http://www.stata.com/support/faqs/data/group.html

Nick
[email protected]

Erica Seiguer
>
> I would like to create a unique identifier from a few variables. The
> variables are the following format: int, str80, str20,
> str34. Is there
> any way to create a single variable combining these
> variables? I will be
> turning the last 3 into int and would ideally like the
> unique identifier
> to contain all 4 variables. For example, if for one observation the
> individual variables are 01, 02, 03 and 04, I would like the unique
> identifier to be 01020304. Does anyone know how to do this?

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index