If your ar merging using z then I suggest just to gen a new variable suming
V1 and V2, it seems that the problem is what variable are you uisng as ID
variable.
Manuel
----- Original Message -----
From: "Fredrik Wallenberg" <[email protected]>
To: <[email protected]>
Sent: Thursday, July 28, 2005 2:13 PM
Subject: st: Data merge/transformation question
> I have two data (Z and E) sets with a many-to-many relationship and
> need some help on how to do the final stage of the merge. This is the
> setup
>
> Dataset Z
> Z E V1
> --------------
> z1 e1 12
> z2 e1 14
> z3 e2 16
>
>
> Dataset E
> E Z V2
> ----------------
> e1 . 6
> e2 . 7
> e3 z2 8
>
> The setup ensures that there is at least one Z mapped to each E and
> vice versa. Merging them I get:
>
> z1 e1 12 6
> z2 e1 14 6
> z2 e3 14 8
> z3 e2 16 8
>
> Now I need to roll aggregate the observations into unique
> observations. In this example I should end up with:
>
> z3e2 16 7
> zXeX 26 14
>
> where the z3e2 is unique from the merged dataset but zXeX is a sum of
> e1 and e3 as well as z1 and z2. My question to all of you is, how do I
> code this last step? I can identify which Zs and Es require "rollup"
> (because there are multiple obsevations). I can also identify
> "overlapping rollups" (case z2 e1 above where both the Z and E in the
> observation requires rollup).
>
> While I can probably figure this out myself given some time I figure I
> should see if anyone has an obvious solution.
>
> Thanks,
>
> Fredrik
>
> *
> * 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/