diff --git a/content/feed/sas-special-missings/index.md b/content/feed/sas-special-missings/index.md index b302f2c..72aaf56 100644 --- a/content/feed/sas-special-missings/index.md +++ b/content/feed/sas-special-missings/index.md @@ -53,10 +53,12 @@ These are Data Controller's own rules, configured per column in the `MPE_VALIDAT - `SOFTSELECT` / `HARDSELECT` - both support special missings; a soft dropdown never blocks a value, and a hard one lists them alongside the ordinary values - `ROUND` - harmless. It only rounds values that are numbers, so a special missing is left exactly as it was typed -The range rules step aside for a missing value, because a missing is not a number for a minimum or a maximum to apply to: +The range rules compare in the order SAS itself uses, which is what makes them interesting here. SAS puts every missing below every non-missing value, and orders the missing values among themselves: `._` is the lowest, then the regular missing, then `.A` through `.Z`. So a range can be written in special missings and mean exactly what SAS would mean by it: -- `MINVAL` / `MAXVAL` - both accept a special missing, and both still reject a real number that is out of range. Use `NOTNULL` if the column has to be populated; a range rule alone leaves the column free to hold a missing -- The rule's own value has to be a number: put a special missing in `MINVAL` and every real number in the column fails, and the same in `MAXVAL` - a rule value that is not a number leaves nothing for a value to pass +- `MINVAL .A` with `MAXVAL .C` accepts `.B` and rejects `.D`, and a blank - the regular missing - fails that floor because it sorts below `.A` +- a number sits above every missing, so it passes a floor of `.A` and fails a ceiling of `.C` +- against a numeric bound the ordering does the obvious thing: a missing sorts below every number, so it fails a `MINVAL` of 1 and passes a `MAXVAL` of 100. Use `NOTNULL` if the column has to be populated +- a rule value that is neither a number nor a special missing - a typo such as `..` or `AB` - satisfies nothing, so the column fails until the rule is corrected A formula is the one case where a special missing genuinely does not work: @@ -106,12 +108,11 @@ How they behave in Data Controller's validation rules: - SOFTSELECT and HARDSELECT both support them - ROUND leaves it alone, because it only rounds numbers -The range rules step aside for one - a missing is not a number for a minimum or a maximum to apply to: +The range rules compare in SAS's own order, so a range can be written in special missings: MINVAL .A with MAXVAL .C accepts .B and rejects .D. A missing sorts below every number, so it fails a numeric MINVAL and passes a numeric MAXVAL; a number sits above every missing. -- MINVAL and MAXVAL both accept it, and both still reject a real number that is out of range; use NOTNULL if the column must be populated - a HARDFORMULA/SOFTFORMULA that reads a special-missing cell returns #VALUE! rather than a number -In short: a value for the pattern and dropdown rules, a missing value for anything that wants a number. +In short: a value for the pattern and dropdown rules, and a value with its own place in the order for the range rules. The video shows the whole cycle - entering them, the rejections, submit, approve, and the DIFF.