Statalist


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

st:merge


From   [email protected]
To   [email protected]
Subject   st:merge
Date   Sat, 12 Sep 2009 03:06:32 -0400 (EDT)

Hi there,

                Can anyone help me with the following problem? I have two
data sets.


The first one is as follows

Data 1


fid   fname	newid             fid= firm's id

0	A	1
1	B	2                 fname= firm's name
2	C	3
3	E	4
4	F	5
5	G	6
6	H	7
7	I	8
8	J	9
9	M	10
10	N	11
11	Q	12
12	P	13
13	R	14
14	S	15


The second one looks like as follows

Data 2

fid   n_fid	dist	          n_fid= nearby firm's id

0	1	.04	          dist= distancs between fid 0 & n_fid
0	2	.03
0	3	.1
0	4	.09
0	5	.05
0	6	.07
0	7	.08
0	8	.06


Now I would like them to be merged/combined in a way that would yield the
following output.


fid   n_fid	dist  fname  newid  n_fname  n_newid

0	1	.04     A      1      B        1
0	2	.03	A      1      C        2
0	3	.1	A      1      E        3
0	4	.09	A      1      F        4
0	5	.05	A      1      G        5
0	6	.07	A      1      H        6
0	7	.08	A      1      I        7
0	8	.06     A      1      J        8

(n_fname= name of nearby firms, n_newid= newid of nearby firms)

Basically, I need to have the n_fid's corresponding name (n_fname) and
newid(n_newid)


Thanks in advance.

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