Statalist


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

Re: st: merge command


From   MAY BAYDOUN <[email protected]>
To   [email protected]
Subject   Re: st: merge command
Date   Thu, 24 Jul 2008 10:10:15 -0700 (PDT)

Hello Ziad,

Why not use the merge command rather than joinby? Make sure both files are under the same directory. You can first specify the current directory as:

cd "C:\Documents and Settings\Administrator\MyDocuments\Ziad_files"

pwd

sort id

merge id using file2


You will automatically get a _merge variable in your dataset that shows where the cases came from. Just make sure this variable did not exist beforehand in both files1 and file2. You can drop it in each one using:

drop _merge

Hope this helps!

May


May Baydoun, PhD in Epidemiology (UNC-Chapel Hill)  Staff Scientist,  National Institute on Aging, NIH/IRP,  Biomedical Research Center,  Baltimore, MD


--- On Thu, 7/24/08, Ziad El-Khatib <[email protected]> wrote:

> From: Ziad El-Khatib <[email protected]>
> Subject: st: merge command
> To: [email protected]
> Date: Thursday, July 24, 2008, 10:47 AM
> Hi!
> I wrote merge command in do file and always run it without
> problem.
> Today i got strange message
> 
> _merge invalid name
> r(198);
> 
> The command is pasted below
> 
> joinby studyid using "C:\Documents and
> Settings\Administrator\My
> Documents\Ziad_files\table01_080716.dta",_merge(_merge)
> 
> 
> Any tips?
> Thank you and best regards
> ziad
> 
> *
> *   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index