[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Generating a unique ID

From   "Mansour Farahani" <>
To   <>
Subject   st: Generating a unique ID
Date   Wed, 21 Nov 2007 18:22:21 -0500

Dear Statalisters:
 I have a unbalanced dataset where variables of interest, categorized by age and place of residence (urban rural) in 15 age groups, are observed in 15 states, over 33 years. For example, mortality rate for rural boys age 10-15 in state i at time t. some of categories in certain years and states are (randomly?) missing.

I want to create a unique ID number based on state (1 to 15), year (1 to 33), age (1 to 15), sex (1,2),and  place of residence (1,2), so that I have a UNIQUE ID for every row in the data. One possible format is that the ID have a max of 8 digits, xx xx xx x x such that first 2 digits are state (00 to 15) then year and so on.
I appreciate any idea on how I can do it in Stata.

Many thanks,


*   For searches and help try:

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