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

RE: st: create unique variables


From   "David Harrison" <David@icnarc.org>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: create unique variables
Date   Fri, 4 Feb 2005 11:28:13 -0000

The numbering will be ordered according to the sort order of the variables specified inside the group function (although the actual sort order of the data will not change). If you want them ordered by another variable then one of the more complex solutions will be required.

David
david@icnarc.org

-----Original Message-----
From: Buechte, Sebastian (Institut für Arbeitswissenschaften)
[mailto:sebastian.buechte@rag.de]
Sent: 04 February 2005 11:19
To: statalist@hsphsun2.harvard.edu
Subject: AW: st: create unique variables


David,

honestly, nothing. Maybe its just too easy...

But how would you influence how the values will be ordered for the numbering process? When using the bysort-thing, you can decide how the values will be ordered before the id is attached to them. When using  egen's group function, do you have to sort the data before?

Regards,
sebastian


> 
> While both of the suggestions so far work fine, what is wrong 
> with just:
> 
> egen id=group(firstname lastname dob)
> 
> David
> david@icnarc.org
> 

*
*   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/



*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index