[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Strange -joinby- behaviour...

From   Neil Shephard <>
Subject   st: Strange -joinby- behaviour...
Date   Fri, 6 Feb 2009 15:40:21 +0000

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
*! version 2.0.5  11Jan2001

I can't suss out why this might be happening, any thoughts or advice
are more than welcome,



"Only two things are infinite, the universe and human stupidity, and
I'm not sure about the former." - Albert Einstein

Email -
Website -
Photos -
*   For searches and help try:

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