{
  "name": "SAS MERGE join behaviour and equivalent open-source controls",
  "description": "Compares how the SAS DATA step MERGE statement, the R base merge() function and pandas.merge() control which keys are kept, compiled from each tool's official documentation read on 2026-11-17. Cells paraphrase the documented behaviour.",
  "page": "https://casrai.org/guides/sas-merge",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-17T04:06:57Z",
  "temporalCoverage": null,
  "spatialCoverage": null,
  "columns": [
    {
      "name": "Tool",
      "unit": "",
      "description": ""
    },
    {
      "name": "Function",
      "unit": "",
      "description": ""
    },
    {
      "name": "Keeps unmatched keys",
      "unit": "",
      "description": ""
    },
    {
      "name": "Control over join type",
      "unit": "",
      "description": ""
    }
  ],
  "rows": [
    {
      "Tool": "SAS",
      "Function": "MERGE statement with BY",
      "Keeps unmatched keys": "Yes: all observations of all data sets are processed",
      "Control over join type": "IN= flags with a subsetting IF"
    },
    {
      "Tool": "R (base)",
      "Function": "merge()",
      "Keeps unmatched keys": "Extra rows for unmatched keys are added when all.x or all.y is TRUE",
      "Control over join type": "all, all.x, all.y"
    },
    {
      "Tool": "Python (pandas)",
      "Function": "pandas.merge()",
      "Keeps unmatched keys": "Depends on how; default is inner",
      "Control over join type": "how: left, right, outer, inner, cross"
    }
  ],
  "sources": [
    {
      "title": "SAS MERGE Statement",
      "url": "https://support.sas.com/documentation/cdl/en/lestmtsref/63323/HTML/default/n1i8w2bwu1fn5kn1gpxj18xttbb0.htm",
      "accessed": "2026-11-17"
    },
    {
      "title": "R merge documentation",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/base/html/merge.html",
      "accessed": "2026-11-17"
    },
    {
      "title": "pandas.merge",
      "url": "https://pandas.pydata.org/docs/reference/api/pandas.merge.html",
      "accessed": "2026-11-17"
    },
    {
      "title": "SAS IN= data set option",
      "url": "https://support.sas.com/documentation/cdl/en/ledsoptsref/69751/HTML/default/n1p1o2dsuc465nn198ovwdrj9mvy.htm",
      "accessed": "2026-11-17"
    }
  ]
}