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/