diff --git a/all.sas b/all.sas
index dfc509b..967fac4 100644
--- a/all.sas
+++ b/all.sas
@@ -67,7 +67,6 @@ options noquotelenmax;
+
+ | Transaction Type | Key Behaviour | Column Behaviour |
+
+
+ | Deletes |
+
+ The row is added to `&outDEL.` UNLESS it no longer exists
+ in the base table, in which case it is added to `&errDS.` instead.
+ |
+
+ Deletes are unaffected by the addition or removal of non Primary-Key
+ columns.
+ |
+
+
+ | Inserts |
+
+ Previously newly added rows are added to the `outADD` table UNLESS they
+ are present in the Base table. In this case they are added to the
+ `&errDS.` table instead.
+ |
+
+ Inserts are unaffected by the addition of columns in the Base Table
+ (they are padded with blanks). Deleted columns are only a problem if
+ they appear on the previous insert - in which case the record is added
+ to `&errDS.`.
+ |
+
+
+ | Updates |
+
+ Previously modified rows are merged with base table values such that
+ only the individual cells that were _previously_ changed are re-applied.
+ Where the row contains cells that were not marked as having changed in
+ the prior transaction, the 'blanks' are filled with base table values in
+ the `outMOD` table.
+ If the row no longer exists on the base table, then the row is added to
+ the `errDS` table instead.
+ |
+
+ Updates are unaffected by the addition of columns in the Base Table -
+ the new cells are simply populated with Base Table values. Deleted
+ columns are only a problem if they relate to a modified cell
+ (`is_diff=1`) - in which case the record is added to `&errDS.`.
+ |
+
+
+
+ To illustrate the above with a diagram:
+
+ @dot
+ digraph {
+ rankdir="TB"
+ start[label="Transaction Type?" shape=Mdiamond]
+ del[label="Does Base Row exist?" shape=rectangle]
+ add [label="Does Base Row exist?" shape=rectangle]
+ mod [label="Does Base Row exist?" shape=rectangle]
+ chkmod [label="Do all modified\n(is_diff=1) cells exist?" shape=rectangle]
+ chkadd [label="Do all inserted cells exist?" shape=rectangle]
+ outmod [label="outMOD\nTable" shape=Msquare style=filled]
+ outadd [label="outADD\nTable" shape=Msquare style=filled]
+ outdel [label="outDEL\nTable" shape=Msquare style=filled]
+ outerr [label="ErrDS Table" shape=Msquare fillcolor=Orange style=filled]
+ start -> del [label="Delete"]
+ start -> add [label="Insert"]
+ start -> mod [label="Update"]
+
+ del -> outdel [label="Yes"]
+ del -> outerr [label="No" color="Red" fontcolor="Red"]
+ add -> chkadd [label="No"]
+ add -> outerr [label="Yes" color="Red" fontcolor="Red"]
+ mod -> outerr [label="No" color="Red" fontcolor="Red"]
+ mod -> chkmod [label="Yes"]
+ chkmod -> outerr [label="No" color="Red" fontcolor="Red"]
+ chkmod -> outmod [label="Yes"]
+ chkadd -> outerr [label="No" color="Red" fontcolor="Red"]
+ chkadd -> outadd [label="Yes"]
+
+ }
+ @enddot
+
+ For examples of usage, check out the mp_stackdiffs.test.sas program.
+
+
+ @param [in] baselibds Base Table against which the changes will be applied,
+ in libref.dataset format.
+ @param [in] auditlibds Dataset with previously applied transactions, to be
+ re-applied. Use libref.dataset format.
+ DDL as follows: %mp_coretable(DIFFTABLE)
+ @param [in] key Space seperated list of key variables
+ @param [in] mdebug= Set to 1 to enable DEBUG messages and preserve outputs
+ @param [in] processed_dttm_var= (0) If a variable is being used to mark
+ the processed datetime, put the name of the variable here. It will NOT
+ be included in the staged dataset (the load process is expected to
+ provide this)
+ @param [out] errds= (work.errds) Output table containing problematic records.
+ The columns of this table are:
+ @li PK_VARS - Space separated list of primary key variable names
+ @li PK_VALS - Slash separted list of PK variable values
+ @li ERR_MSG - Explanation of why this record is problematic
+ @param [out] outmod= (work.outmod) Output table containing modified records
+ @param [out] outadd= (work.outadd) Output table containing additional records
+ @param [out] outdel= (work.outdel) Output table containing deleted records
+
+
+