Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: creating a new variable with different values for each record considering values in two different variables


From   Raffaele Palladino <[email protected]>
To   [email protected]
Subject   st: creating a new variable with different values for each record considering values in two different variables
Date   Tue, 18 Mar 2014 16:04:03 +0100

Dear statalist user, here it is a question for you:
I have a dataset with an "id" that is referred to each person but it can be repeated in the dataset, than I have another variable "class", that stands for a classification, it can be repeated in the database as well. I would need to create a new id, unique for each record, that defines each record not only for the id by also for the class. Something like in the example below:

id		class		id2
1		a			1
1		b			2
3		f			3
2		b			4

There must be some combination of egen and by but I wasn't capable of finding it. Many thanks in advance!



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index