This example shows template programming code specified for an analysis method defined in the methods attribute of the reporting event (lines 16-44). In this example, there are 3 parameters associated with the template programming code, each containing a reference to a metadata element in the valueSource attribute. The metadata references are defined relative to the analysis using the method, so any unqualified metadata element name (e.g. "dataset") is a reference to an attribute of the analysis using the method. The valueSource values for 2 of the parameters are in the format orderedGroupings[x].groupingId.groupingVariable
which indicates (according to the sponsor's applied syntax) "the value of the groupingVariable attribute of the instance of the (subject or data) grouping factor referenced in the groupingId attribute of an instance of the OrderedGroupingFactor class, which is listed in the orderedGroupings attribute of the analysis and whose order value is x". The template programming statements (for which the computer language is "SAS Version 9.4", as specified in the context attribute) contain replacement parameter references corresponding with the 3 template code parameters. The parameter references are formatted to facilitate the sponsor's Python-based implementation, which involved copying the template programming code to the analysis while replacing the replacement parameter references with the values obtained from the metadata references in order to create analysis-specific programming statements that are ready for execution.
The example also shows, in the analyses attribute of the reporting event, the definition of an analysis that uses the defined method and contains the resultant programming statements in its programmingCode attribute (lines 45-66). The sponsor chose not to record the analysis-specific parameter values with the analysis because they are already represented in the analysis-specific programming code.
Partial definitions of the referenced grouping factors are also shown in the reporting event's analysisGroupings attribute (lines 1-15) to show the metadata values that were obtained via the metadata references. The details of the groups within the grouping factors have been omitted for brevity.
analysisGroupings: - id: AnlsGrouping_01_Trt name: Treatment groupingDataset: ADSL groupingVariable: TRT01A dataDriven: false groups: ... - id: AnlsGrouping_03_AgeGp name: Age Group groupingDataset: ADSL groupingVariable: AGEGR1 dataDriven: false groups: ... methods: - id: Mth03_CatVar_Comp_PChiSq name: Pearson's chi-square test group comparison for a categorical variable description: Comparison of groups by Pearson's chi-square test for a categorical variable. Maximum of two grouping variables. label: Pearson's chi-square test operations: - id: Mth03_CatVar_Comp_PChiSq_1_pval name: P-value label: p-value order: 1 resultPattern: X.XXXX codeTemplate: context: SAS Version 9.4 code: "proc freq data={dataset}; table {grp1var}*{grp2var}/chisq; exact pchi; ods output PearsonChiSq=PCHI{grp2var}; run;" parameters: - name: dataset description: Input dataset valueSource: dataset - name: grp1var description: First grouping variable valueSource: orderedGroupings[1].groupingId.groupingVariable - name: grp2var description: Second grouping variable valueSource: orderedGroupings[2].groupingId.groupingVariable analyses: - name: Comparison of Age Group by Treatment id: An03_02_AgeGrp_Comp_ByTrt methodId: Mth03_CatVar_Comp_PChiSq version: 1 dataset: ADSL variable: USUBJID analysisSetId: AnalysisSet_02_SAF orderedGroupings: - order: 1 resultsByGroup: false groupingId: AnlsGrouping_01_Trt - order: 2 resultsByGroup: false groupingId: AnlsGrouping_03_AgeGp programmingCode: context: SAS Version 9.4 code: "proc freq data=ADSL; table TRT01A*AGEGR1/chisq; exact pchi; ods output PearsonChiSq=PCHIAGEGR1; run;"