The variable mapping aggregate function allows calculation of aggregate details from the underlying data, which can be used for reporting purposes.
Example: Create a field that displays the first lab result for a given subject to help assess changes.
- Select the domain in the Domain Editor window, then click the Variable button and select Aggregate/Rank.
- An aggregate box is added to the selected domain, and a warning displays in the Preview area (lower section of the window) to specify settings.
- The Aggregate options also display in the Domain Properties subpanel.
- In the Domain Properties subpanel, click the ellipsis in Aggregate field. The Edit Aggregate window opens.
- In the Name field, enter a name for the aggregate data. For example, Base_Result.
- In the Function field, click the drop-down and select a function.
- Example: First Row
- Available options include:
- Count
- Sum
- Minimum
- Maximum
- Average
- Standard Deviation
- Variance
- Row Number (can be used to create a sequence)
- Rank
- Dense Rank
- Previous Row
- Next Row
- First Row
- Last Row
- Cumulative Distribution
- In the Field field, click the drop-down and select the field to apply the function to.
- Example: LBORRES.
Note: Not all aggregate functions require a field selection. For example, the Row Number function does not require a field.
- In the Group/Partition By field, select a field to group by.
- Example: USUBJID and LBTESTCD.
- This captures the first row for each subject and lab test. Without a group-by, the results include all records.
- In the Order By field, select a field to determine the order of the function.
- Example: USUBJID.
This defines the logical order in which the operation performed.
Note: Not all functions require an Order By field.
- Click Save. The system returns to the Domain Editor window, and the results of the aggregate function display in the Preview area.
Aggregate data can be used to create separate summary tables or joined back to the original data for comparison.
Example: In the previous example, the aggregate details represent the base results for each lab test for each subject. These can be joined back to the lab results based on USUBJID and LBTEST. The resulting lab table contains a baseline record for each lab test, allowing direct comparison results.