Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: question about merge / lookup (was Re: statlist: offlist follow up)


From   "Sebastian Kruk" <[email protected]>
To   [email protected]
Subject   Re: question about merge / lookup (was Re: statlist: offlist follow up)
Date   Tue, 17 Jul 2007 02:30:22 -0300

Sorry Michael, I thought it was sent it by statalist. I have problems
some weeks ago because I sent a message off-list.

I have two datasets (a.dta and b.dta) as follows:

a.dta
agegp	dpto	e1	proyeccion
0	1	1	9261
1	1	1	36894
5	1	1	47986
0	1	1	48976
1	1	2	8863
5	1	2	35504
0	2	2	46194
1	2	1	47042
5	2	1	10401
0	2	2	4555
1	2	2	1543
5	2	2	519

b.dta:

agegp	dpto	e1	vaca0	vaca1
0	1	1	9261	6174
1	1	1	36894	24596
5	1	1	47986	31990
0	1	1	48976	32650
1	1	2	8863	5908
5	1	2	35504	23669
0	2	2	2133	455
1	2	1	2212	48971
5	2	1	108	1170
0	2	2	20	4304
1	2	2	238	566
5	2	2	2	72
0	1	1	9261	61
1	1	1	36894	245
5	1	1	47986	31
0	1	1	48976	3
1	1	2	8863	590
5	1	2	35504	236
0	2	2	213	455
1	2	1	221	48
5	2	1	108	11
0	2	2	2074	43
1	2	2	238	5
5	2	2	269	72

I am trying to merge the two datasets such that the new dataset should read as:

agegp	dpto	e1	vaca0	vaca1	proyeccion
0	1	1	9261	6174	9261
1	1	1	36894	24596	36894
5	1	1	47986	31990	47986
0	1	1	48976	32650	48976
1	1	2	8863	5908	8863
5	1	2	35504	23669	35504
0	2	2	2133	455	46194
1	2	1	2212	48971	47042
5	2	1	108	1170	10401
0	2	2	20	4304	4555
1	2	2	238	566	1543
5	2	2	2	72	519
0	1	1	9261	61	9261
1	1	1	36894	245	36894
5	1	1	47986	31	47986
0	1	1	48976	3	9261
1	1	2	8863	590	8863
5	1	2	35504	236	35504
0	2	2	213	455	46194
1	2	1	221	48	47042
5	2	1	108	11	10401
0	2	2	2074	43	4555
1	2	2	238	5	1543
5	2	2	269	72	519

Thanks.

Sebasti�n.

2007/7/17, Michael Blasnik <[email protected]>:
..
Your first (?) issue is not a problem -- it is an informational message if you
are doing a "look-up" type merge (or "many to one" merge).

If your second question asks about how to create the lookup table of proyection
values -- that depends on if you already have them stored somehow and if you can
get them into aa Stata dataset.  You can always use -generate- and -replace- to
type them in.

By the way, it is not good form to include an offlist follow-up, provided as
courtesy, as part of a message back to the full Statalist.  I will not extend
the courtesy again.

Michael Blasnik


----- Original Message -----
From: "Sebastian Kruk" <[email protected]>
To: <[email protected]>
Sent: Monday, July 16, 2007 9:05 PM
Subject: Re: statlist: offlist follow up


>I have the next problem when I use merge "variable dpto agegp e1 does
> not uniquely identify observations in the master data"
>
> I know it, because every observation which has same value in dpto
> agegp e1 must have the same proyection.
>
> How a proyection can be added by dpto agegp e1 variables?
>

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