Skip to content

Commit

Permalink
Add -keepnone- option to join.ado
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiocorreia committed Apr 4, 2017
1 parent 07fb737 commit e6d9669
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
# FTOOLS: A faster Stata for large datasets

- Current version: `2.9.0 28mar2017`
- Current version: `2.10.0 3apr2017`
- Jump to: [`usage`](#usage) [`benchmarks`](#benchmarks) [`install`](#installation)

-----------
Expand Down
9 changes: 8 additions & 1 deletion src/fmerge.ado
@@ -1,4 +1,4 @@
*! version 2.9.0 28mar2017
*! version 2.10.0 3apr2017
* wrapper for join.ado, parsing code based on merge.ado

program define fmerge
Expand Down Expand Up @@ -36,11 +36,18 @@ program define fmerge

loc uniquemaster = cond("`mtype'" == "1:1", "uniquemaster", "")

loc check = "`keepusing'"!=""
loc keepusing : list keepusing - varlist
if ("`keepusing'"=="" & `check') {
loc keepnone keepnone // don't keep any variable from using
}

loc cmd join `keepusing', ///
from(`using') ///
by(`varlist') ///
keep(`keep') ///
assert(`assert') ///
`keepnone' ///
`generate' ///
`nogenerate' ///
`uniquemaster' ///
Expand Down
2 changes: 1 addition & 1 deletion src/fmerge.sthlp
@@ -1,5 +1,5 @@
{smcl}
{* *! version 1.9.0 10jan2017}{...}
{* *! version 2.10.0 3apr2017}{...}
{vieweralsosee "ftools" "help ftools"}{...}
{vieweralsosee "join" "help join"}{...}
{vieweralsosee "[R] merge" "help merge"}{...}
Expand Down
7 changes: 4 additions & 3 deletions src/join.ado
@@ -1,10 +1,10 @@
*! version 2.9.0 28mar2017
*! version 2.10.0 3apr2017
program define join

// Parse --------------------------------------------------------------------

syntax ///
[anything] /// Variables that will be added (default is _all)
[anything] /// Variables that will be added (default is _all unless keepnone is used)
, ///
[from(string asis) into(string asis)] /// -using- dataset
[by(string)] /// Primary and foreign keys
Expand All @@ -13,6 +13,7 @@ program define join
[GENerate(name) NOGENerate] /// _merge variable
[UNIQuemaster] /// Assert that -by- is an id in the master dataset
[noLabel] ///
[KEEPNone] ///
[noNOTEs] ///
[noREPort] ///
[Verbose]
Expand Down Expand Up @@ -70,7 +71,7 @@ program define join
loc cmd `"qui use `if' using "`filename'", clear"'
}

if ("`anything'" != "") {
if ("`anything'" != "" | "`keepnone'"!=""}) {
keep `using_keys' `anything'
}
else {
Expand Down
10 changes: 9 additions & 1 deletion src/join.sthlp
@@ -1,5 +1,5 @@
{smcl}
{* *! version 1.9.0 10jan2017}{...}
{* *! version 2.10.0 3apr2017}{...}
{vieweralsosee "ftools" "help ftools"}{...}
{vieweralsosee "fmerge" "help fmerge"}{...}
{vieweralsosee "[R] merge" "help merge"}{...}
Expand Down Expand Up @@ -71,6 +71,8 @@ As above, but with the "using" dataset currently open instead of the "master"
{...}
{synopt :{opt nonote:s}}do not copy notes from using{p_end}
{...}
{synopt :{opt keepn:one}}don't add any variables from using (overrides default of {it:_all}){p_end}
{...}
{synopt :{opt v:erbose}}show internal debug info
{p_end}
{synoptline}
Expand Down Expand Up @@ -172,6 +174,12 @@ above 100,000 observations (due to Mata's overhead).
specifies that notes in the using dataset not be added to the
merged dataset; see {manhelp notes D:notes}.

{phang}
{cmd:keepnone}
specifies that no variables from using will be added. Use this in combination
with {cmd:keep(match)} if you just want to keep a group of observations
from the master dataset.

{phang}
{cmd:noreport}
specifies that {cmd:join} not present its summary table of
Expand Down

0 comments on commit e6d9669

Please sign in to comment.