Hi Marteen,
The solution you offered would only yield the fid's
corresponding fname (here, its A) but not the n_fids
corresponding n_fname.
Is there any other solution that you can help me with?
Thanks
Arnab
> *---------------- begin example --------------
> clear
> input fid str1 fname newid
> 0 A 1
> 1 B 2
> 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
> end
> sort fid
> tempfile a
> save `a', replace
>
> drop _all
> input fid n_fid dist
>
> 0 1 .04
> 0 2 .03
> 0 3 .1
> 0 4 .09
> 0 5 .05
> 0 6 .07
> 0 7 .08
> 0 8 .06
> end
>
> sort fid
>
> merge fid using `a'
> list
> *--------------- end example -------------------
> ( For more on how to use examples I sent to statalist see:
> http://www.maartenbuis.nl/stata/exampleFAQ.html )
>
> Hope this helps,
> Maarten
>
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
> http://www.maartenbuis.nl
> --------------------------
>
>
> --- On Sat, 12/9/09, [email protected] <[email protected]> wrote:
>
>> From: [email protected] <[email protected]>
>> Subject: st:merge
>> To: [email protected]
>> Date: Saturday, 12 September, 2009, 8:06 AM
>> 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/
>>
>
>
>
>
> *
> * 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/