Statalist


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

Re: st: merging dataset


From   "ricardo sierra" <[email protected]>
To   [email protected]
Subject   Re: st: merging dataset
Date   Fri, 31 Aug 2007 09:30:59 -0400

I think the update option in -merge- would work.


clear
input id var1 var2 var3

12     785     .         748
45     74       2        63
74     789     0        7485

end
sort id
save AA, replace

clear
input id var1 var2 var3

12      .         45        748
94      41       78        74
74      789     0          7485

end

save BB, replace
sort id
merge id using AA, update
list


On 8/31/07, Rima Chakravarty <[email protected]> wrote:
> Wondering if anybody can help me with this. I want to merge two dataset (AA and BB) based on ID.
>
> Dataset AA
> ID    Var 1   Var 2   Var 3
> 12     785     .         748
> 45     74       2        63
> 74     789     0        7485
>
>
> Dataset BB
> ID    Var 1   Var 2    Var 3
> 12      .         45        748
> 94      41       78        74
> 74      789     0          7485
>
> I have used the merge command but the problem with that is that the dataset BB has missing value for ID =12 (Var 1). I want to replace the non-missing value in the merged dataset with the missing value and I think the merge command do not do that. Everything else did correctly.
>
> Any suggestion !
>
> Rima
>
>
> _______________________________________________________________
>
> Rima Chakravarty
> Economist
> Policy Analysis and Statistics Division
> NC Department of Revenue
> Phone: 919.733.7738
>
>
>
> ------------------------------------------------------------------------------
> E-Mail correspondence to and from this sender may be subject to the
> North Carolina Public Records Law, and may be disclosed to third parties.
> ------------------------------------------------------------------------------
>
> *
> *   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