Thanks to Kit Baum, a new version of rangejoin is now available on SSC. Stata 11 is required. You also need to install the latest version of rangestat (1.1.0) in order to use this updated version of rangejoin.
To update both rangestat and rangejoin, type in Stata's Command window
For a first install, type
Once installed/updated, type
to get more information.
rangejoin forms pairwise combinations between observations in memory and observations in a using dataset when the value of a key variable in the using dataset is within the range specified by observations in the data in memory. rangejoin leverages the power of rangestat (from SSC, with Nick Cox and Roberto Ferrer) to implement what amounts to a joinby over a range of values. The observations in memory define the low and high bounds of the interval to use and the values of a key variable in the using dataset determines which observations are to be paired.
This version fixes a problem in the previous version when an interval bound was computed by adding an offset to the value of the key variable and the computed bound could not be stored in a variable of the key variable's data type. This was most likely to bite when the key variable was a byte. The overflow would be treated as a missing bound and affected observations were excluded from the sample. Many thanks to Clyde Schechter for bringing this to our attention.
Missing interval bounds are now allowed and handled using the rules that Stata uses for its inrange() function: if the lower bound is missing, observations will match up to and including the value of the higher bound. If both low and high bounds are missing, all observations will match.
The help file has been completely revamped and features a new way to present examples that can be easily tried via a click to run link. Each example is presented in a code block and is run as a do-file. The code that runs is exactly what is shown in the help file. Long lines are split using the /// line continuation indicator.
To update both rangestat and rangejoin, type in Stata's Command window
Code:
adoupdate rangestat adoupdate rangejoin
Code:
ssc install rangestat ssc install rangejoin
Code:
help rangejoin
rangejoin forms pairwise combinations between observations in memory and observations in a using dataset when the value of a key variable in the using dataset is within the range specified by observations in the data in memory. rangejoin leverages the power of rangestat (from SSC, with Nick Cox and Roberto Ferrer) to implement what amounts to a joinby over a range of values. The observations in memory define the low and high bounds of the interval to use and the values of a key variable in the using dataset determines which observations are to be paired.
This version fixes a problem in the previous version when an interval bound was computed by adding an offset to the value of the key variable and the computed bound could not be stored in a variable of the key variable's data type. This was most likely to bite when the key variable was a byte. The overflow would be treated as a missing bound and affected observations were excluded from the sample. Many thanks to Clyde Schechter for bringing this to our attention.
Missing interval bounds are now allowed and handled using the rules that Stata uses for its inrange() function: if the lower bound is missing, observations will match up to and including the value of the higher bound. If both low and high bounds are missing, all observations will match.
The help file has been completely revamped and features a new way to present examples that can be easily tried via a click to run link. Each example is presented in a code block and is run as a do-file. The code that runs is exactly what is shown in the help file. Long lines are split using the /// line continuation indicator.
Comment