docs(config): VAR_* column names in MPE_DERIVED

Matches dc/dc: VAR_NM, VAR_ORDER, VAR_TYPE, VAR_LEN, VAR_FMT, VAR_LOGIC.
This commit is contained in:
dc committed 2026-10-20 07:57:59 +00:00
1 parent e233f508b6
commit b9f7300708
2 files changed
+30 -30

No files matched your search

+24 -24
View File
@@ -19,36 +19,36 @@ Derived variables are configured per table in the [MPE_DERIVED](/tables/mpe_deri
Each row defines one variable: Each row defines one variable:
- `LIBREF` / `DSN` - the target table - `LIBREF` / `DSN` - the target table
- `VARIABLE_NM` - the name of the new column - `VAR_NM` - the name of the new column
- `VARIABLE_ORDER` - evaluation order; a variable may reference one with a lower order - `VAR_ORDER` - evaluation order; a variable may reference one with a lower order
- `VARIABLE_TYPE` - `C` for character, `N` for numeric - `VAR_TYPE` - `C` for character, `N` for numeric
- `VARIABLE_LENGTH` - character length, or numeric length (1-8) - `VAR_LEN` - character length, or numeric length (1-8)
- `VARIABLE_FORMAT` - optional, eg `DATE9.` or `DOLLAR12.2` - `VAR_FMT` - optional, eg `DATE9.` or `DOLLAR12.2`
- `VARIABLE_LOGIC` - the SAS expression that produces the value - `VAR_LOGIC` - the SAS expression that produces the value
- `ACTIVE` - set to 1 to apply the variable - `ACTIVE` - set to 1 to apply the variable
A simple example, deriving a region from a state: A simple example, deriving a region from a state:
``` ```
VARIABLE_NM REGION VAR_NM REGION
VARIABLE_ORDER 10 VAR_ORDER 10
VARIABLE_TYPE C VAR_TYPE C
VARIABLE_LENGTH 8 VAR_LEN 8
VARIABLE_FORMAT (blank) VAR_FMT (blank)
VARIABLE_LOGIC ifc(STATE in ('CA','OR','WA'),'West','East') VAR_LOGIC ifc(STATE in ('CA','OR','WA'),'West','East')
ACTIVE 1 ACTIVE 1
``` ```
A later variable can build on it, provided its order is higher: A later variable can build on it, provided its order is higher:
``` ```
VARIABLE_NM REGION_LABEL VAR_NM REGION_LABEL
VARIABLE_ORDER 20 VAR_ORDER 20
VARIABLE_TYPE C VAR_TYPE C
VARIABLE_LENGTH 14 VAR_LEN 14
VARIABLE_FORMAT (blank) VAR_FMT (blank)
VARIABLE_LOGIC cats(REGION,'-',STATE) VAR_LOGIC cats(REGION,'-',STATE)
ACTIVE 1 ACTIVE 1
``` ```
For each row, Data Controller generates the following statements when the table is read: For each row, Data Controller generates the following statements when the table is read:
@@ -60,7 +60,7 @@ REGION = ifc(STATE in ('CA','OR','WA'),'West','East');
The label defaults to the expression itself, prefixed with `DERIVED: `, so that computed columns are obvious when labels are switched on. The expression is truncated to the maximum label length. The label defaults to the expression itself, prefixed with `DERIVED: `, so that computed columns are obvious when labels are switched on. The expression is truncated to the maximum label length.
The type and length are declared, not inferred, so a value is truncated exactly as you specify. If `VARIABLE_FORMAT` is left blank, character variables default to `$<length>.` and numeric variables to `<length>.`; a date, time or datetime format makes the column render (and filter) as a date, time or datetime, the same way a stored column does. The type and length are declared, not inferred, so a value is truncated exactly as you specify. If `VAR_FMT` is left blank, character variables default to `$<length>.` and numeric variables to `<length>.`; a date, time or datetime format makes the column render (and filter) as a date, time or datetime, the same way a stored column does.
## Filtering ## Filtering
@@ -70,9 +70,9 @@ Derived columns themselves are an EDIT screen feature: the VIEW screen and the d
## Rules and limits ## Rules and limits
- **Expressions only.** `VARIABLE_LOGIC` must be a single SAS expression - no semicolons, macro triggers (`%`, `&`) or comments. Conditional logic is available through functions such as `ifc()`, `choosec()`, `cats()`, `catx()`, `put()`, `input()` and `intnx()`. - **Expressions only.** `VAR_LOGIC` must be a single SAS expression - no semicolons, macro triggers (`%`, `&`) or comments. Conditional logic is available through functions such as `ifc()`, `choosec()`, `cats()`, `catx()`, `put()`, `input()` and `intnx()`.
- **Ordered.** Statements are generated in `VARIABLE_ORDER` sequence. An expression may reference the physical columns of the table, and any derived variable with a lower `VARIABLE_ORDER`. A reference to a variable that is not defined earlier is rejected, because SAS would otherwise return a missing value without an error. `VARIABLE_ORDER` is required, and must be a positive integer. - **Ordered.** Statements are generated in `VAR_ORDER` sequence. An expression may reference the physical columns of the table, and any derived variable with a lower `VAR_ORDER`. A reference to a variable that is not defined earlier is rejected, because SAS would otherwise return a missing value without an error. `VAR_ORDER` is required, and must be a positive integer.
- **No collisions.** `VARIABLE_NM` must not match an existing column of the target table, or one of the reserved names (`TX_FROM`, `TX_TO`, `PROCESSED_DTTM`, `VAR_TXFROM`, `VAR_TXTO`, `VAR_PROCESSED`, `_____DELETE__THIS__RECORD_____`). - **No collisions.** `VAR_NM` must not match an existing column of the target table, or one of the reserved names (`TX_FROM`, `TX_TO`, `PROCESSED_DTTM`, `VAR_TXFROM`, `VAR_TXTO`, `VAR_PROCESSED`, `_____DELETE__THIS__RECORD_____`).
- **Read-only.** Derived columns cannot be edited in the grid, and any value submitted for them is discarded before the approval package is created. - **Read-only.** Derived columns cannot be edited in the grid, and any value submitted for them is discarded before the approval package is created.
- **Recomputed on every read.** The value always reflects the current data and the current definition, and there is no history of previous derived values. - **Recomputed on every read.** The value always reflects the current data and the current definition, and there is no history of previous derived values.
+6 -6
View File
@@ -16,10 +16,10 @@ The table is itself registered in [MPE_TABLES](/tables/mpe_tables/), so it is ma
- 🔑 `TX_TO num`: SCD2 close datetime - 🔑 `TX_TO num`: SCD2 close datetime
- 🔑 `LIBREF char(8)`: The libref of the target table - 🔑 `LIBREF char(8)`: The libref of the target table
- 🔑 `DSN char(32)`: The target table - 🔑 `DSN char(32)`: The target table
- 🔑 `VARIABLE_NM char(32)`: The name of the derived column - 🔑 `VAR_NM char(32)`: The name of the derived column
- `VARIABLE_ORDER num`: Evaluation order; a variable may reference one with a lower order - `VAR_ORDER num`: Evaluation order; a variable may reference one with a lower order
- `VARIABLE_TYPE char(1)`: `C` for character, `N` for numeric - `VAR_TYPE char(1)`: `C` for character, `N` for numeric
- `VARIABLE_LENGTH num`: Character length, or numeric length (1-8) - `VAR_LEN num`: Character length, or numeric length (1-8)
- `VARIABLE_FORMAT char(32)`: Optional SAS format, eg `DATE9.` - `VAR_FMT char(32)`: Optional SAS format, eg `DATE9.`
- `VARIABLE_LOGIC char(4000)`: The SAS expression that produces the value - `VAR_LOGIC char(4000)`: The SAS expression that produces the value
- `ACTIVE num`: Set to 1 to apply the variable - `ACTIVE num`: Set to 1 to apply the variable