# Re: st: Re: comparing across observations and variables

 From Dalhia To statalist@hsphsun2.harvard.edu Subject Re: st: Re: comparing across observations and variables Date Thu, 9 Apr 2009 19:00:31 -0700 (PDT)

```Dear Martin,
Thanks. I tried out the code. But that is not what I was trying to say.

In the set below, A2 is at the top of the control pyramid (not A1). Row 1 shows that A2 is the ultimate parent to A and A1.  Row 2 doesn't really add any information.  Row 3 says that A is the ultimate parent to A3 and A4.  However, A's ultimate parent is A2 (according to row 1). Therefore, the firm at the top of this control pyramid is A2.
Similarly, B4 is at the top of a pyramid of Bs since B3 is the ultimate parent to B and B2, but B4 is the ultimate parent to B3.

Firm, Parent, Ultimate Parent
A, A1, A2
A1, A1, A1
A3, A4, A
B, B2, B3
B3, B3, B4

I have about 53,000 such rows of data providing information about various chains of control. Once I figure out the firm at the top of the pyramids, I then need to replace all the firms at the lower levels of the pyramid with the firm at the top.  So in the case of the pyramid formed by the chains of control given above, I need to somehow replace every instance of A, A1, A3, and A4 with A2, and every instance of B, B2, and B3 with B4.

thanks so much for your help on this.
I really appreciate it.
dalhai

--- On Thu, 4/9/09, Martin Weiss <martin.weiss1@gmx.de> wrote:

> From: Martin Weiss <martin.weiss1@gmx.de>
> Subject: st: Re: comparing across observations and variables
> To: statalist@hsphsun2.harvard.edu
> Date: Thursday, April 9, 2009, 11:50 PM
> <>
>
>
> As for the first part: the one firm in the last column that
> appears only once in the dataset has got to be the ultimate
> one in the pyramid, is that right? If so, -count- it:
>
>
> ****
> clear*
>
> inp str2 firm str2 parent  str2 ultimate_parent
> A A1 A2
> A1 A1 A1
> A3 A4 A
> end
>
> levelsof ultimate_parent, local(mylevels)
>
> stack  firm parent ultimate_parent, into(countvar)
> clear
>
> foreach lev of local mylevels{
>  qui cou if countv=="`lev'"
>  di in red "`lev' " `r(N)'
> }
>
> ****
>
>
> HTH
> Martin
> _______________________
> ----- Original Message ----- From: "Dalhia" <ggs_da@yahoo.com>
> To: <statalist@hsphsun2.harvard.edu>
> Sent: Thursday, April 09, 2009 10:33 PM
> Subject: st: comparing across observations and variables
>
>
> > hi,
> > I have two sets of data: data about control
> relationships between firms (firm, parent firm, ultimate
> parent firm) and alliances between firms.  I need a way
> to figure out who is at the top of the control pyramid using
> the first set of data, and then, in the alliance data,
> replace all firms lower down on the control pyramid with the
> firm at the top of the control pyramid.
> >
> > 1) For instance, my data about control relations
> between firms is shown below.  I need a way to
> automatically figure out that A2 is at the top of this
> control pyramid.
> >
> > firm, parent, ultimate parent
> > A, A1, A2
> > A1, A1, A1
> > A3, A4, A
> >
> > 2) My data about alliances between firms is shown
> below:
> >
> > Participant 1, Participant2
> > A, B
> > A3, C
> > A1, D
> >
> > 3) I need to incorporate the data about control
> relationships (A2 is at the top of the control pyramid
> involving A, A1 A3, A4) in the data about alliances so that
> my alliance file looks like this:
> > A2, B
> > A2, C
> > A2, D
> >
> > I will be very grateful for any ideas you can suggest
> to do the above.
> > thanks so much
> > dalhia
> >
> >
> >
> >
> > *
> > *   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/
> >
>
> *
> *   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/
>

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