Neil
I have no answer, but have a couple of suggestions.
* Make a copy of joinby.ado and add a -pause on- at the beginning
* Edit the following
use `"`using'"', replace
tempvar UUNIQUE
confirm new var `_merge'
sort `match'
by `match' : gen long `UUNIQUE' = _n
/*new*/ pause /*you can now -des- -mac dir- -list- to see what
happened in the previous line*/
* The answer may become obvious at this point
* If you are still stumped, perhaps some more info would help including:
- exact command you used for -joinby-
- -describe- the relevant joining variables from both datasets,
perhaps -list-ing a couple of lines
Good luck
DCE
2009/2/6 Neil Shephard <[email protected]>:
> I'm trying to -joinby- two datasets and am experiencing some
> strange/unexpected behaviour.
>
> After -set trace on- I find the error occurs after loading the -using-
> data set. The strange thing is that a new variable is (purportedly)
> being created and then an attempt to sort on that variable is being
> made and it no longer exists...
>
>
> - use `"`using'"', replace
> = use `"C:\DOCUME~1\neils\LOCALS~1\Temp\ST_0t000015.tmp"', replace
> - tempvar UUNIQUE
> - confirm new var `_merge'
> = confirm new var __000000
> - sort `match'
> = sort patientkey carespellid
> - by `match' : gen long `UUNIQUE' = _n
> = by patientkey carespellid : gen long __000002 = _n <----Create variable
> - sort `match' `UUNIQUE'
> = sort patientkey carespellid __000002 <---- Where's it gone?
> variable __000002 not found
>
>
> Standard version information for Stata...
>
> . about
>
> Stata/SE 10.1 for Windows
> Born 02 Feb 2009
> Copyright (C) 1985-2009
>
> ...and the verison of -joinby-.....
>
> . which joinby
> P:\Stata10\ado\base\j\joinby.ado
> *! version 2.0.5 11Jan2001
>
> I can't suss out why this might be happening, any thoughts or advice
> are more than welcome,
>
> Cheers,
>
> Neil
>
>
>
>
> --
> "Only two things are infinite, the universe and human stupidity, and
> I'm not sure about the former." - Albert Einstein
>
> Email - [email protected]
> Website - http://slack.ser.man.ac.uk/
> Photos - http://www.flickr.com/photos/slackline/
> *
> * 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/
>
--
David Elliott
Everything is theoretically impossible, until it is done.
Progress is made by lazy men looking for easier ways to do things.
-- Robert A. Heinlein (American science-fiction Writer, 1907-1988)
*
* 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/