Skip to content

STAR JOIN

Joins a fact table with one or more lookup tables, SQL style (left outer join): every case of the FROM table is kept and gains the selected variables of its matching lookup cases.

STAR JOIN /SELECT alias.var[, alias.var | alias.* …] /FROM *|dataset|'file.sav' AS alias /JOIN dataset|'file.sav' AS alias ON alias.key = alias.key [AND …] [/JOIN …] [/OUTFILE FILE=*|dataset|'file.sav'].
Kind Data management
Body main /SUBCOMMAND[=] …
Changes data yes, undoable
Subcommands /FROM, /JOIN, /OUTFILE, /PASSPROTECT, /SELECT
STAR JOIN /SELECT t0.amount, t1.region, t2.product_name /FROM * AS t0
/JOIN 'customers.sav' AS t1 ON t0.customer_id = t1.customer_id
/JOIN products AS t2 ON t0.product_id = t2.product_id.
STAR JOIN /SELECT t0.*, r.rate /FROM sales AS t0 /JOIN rates AS r ON t0.year = r.year AND t0.country = r.country /OUTFILE FILE=sales_rates.
  • Cases keep the order of the FROM table and no table needs sorting. Cases without a match get missing values, with a count per table.
  • Key combinations must be unique in each JOIN table (an error otherwise); keys with missing values never match. String keys ignore trailing blanks.
  • An ON condition may refer to an earlier JOIN table, so lookups can chain (snowflake schemas).
  • alias.* selects every variable of a table except its join keys (an OrcStat extension). Selecting the same name from two tables is an error; rename one first.
  • Without /OUTFILE (or with FILE=*) the result replaces the active dataset; a dataset name creates or replaces that dataset; a .sav path writes a file and leaves the active dataset unchanged.

MATCH FILES, ADD FILES


Generated from OrcStat’s command registry and reference. To suggest a change, open an issue.