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: Assigning id's to other observations (after expanding)


From   "Ibarra-Caton, Marilyn" <[email protected]>
To   <[email protected]>
Subject   st: Assigning id's to other observations (after expanding)
Date   Tue, 19 Apr 2011 13:24:11 -0400

I am having a hard time with coding to get the data as I need it.  Any
help would be greatly appreciated!!!  

My data looks like this:
      id          Parent id 
1.    Firm1   Firm3
2.    Firm1   Firm3
3.    Firm2   Firm3
4.    Firm3   Firm3 
In words what the data is telling me is that the parent id is the firm
that absorbed the firm in the id column.  So in this case firm 3
absorbed (merged with) firm 1 and firm 2.    

So I want the data to look like this: 

1.    Firm1    Firm3
2.    Firm1    Firm3
3.    Firm2    Firm3

4.    Firm1    Firm3
5.    Firm2    Firm3

So basically duplicate observation 4 and assign the id of observation 1
& 2 to one of the duplicate observations and assign the id of
observation 3 to the other duplicate observation.  For the observation
that I am going to duplicate and assign a new id, it will always be the
case that the id==parent id for this observation before any manipulation
of the data.   I know that to duplicate observation 4 I can use the
expand command.  

Any thoughts on how to assign the id as I need it?  Any help is greatly
appreciated!!  

Thanks!  

Marilyn. 

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


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