sARDenX is an extension of sARDen, aiming to generate CDISC ARD (Analysis Results Data) from a wide range of SAS statistical analysis procedures.
We use ADSL and ADAE created as test data with the “sas_faker” package (https://github.com/Morioka-Yutaka/sas_faker),
but you can freely substitute typical ADSL/ADAE datasets instead, so feel free to adapt that part as you like.
%loadPackage(sas_faker)
%sas_faker(
n_groups=3,
n_per_group=50,
output_lib=WORK,
seed =123456,
create_dm = N,
create_ae = N,
create_sv = N,
create_vs = N,
create_adsl = Y,
create_adae = Y,
create_advs = N
);Performs a two-sample t-test using PROC TTEST and returns ARD-style results.
The macro outputs group means, confidence intervals, and test statistics
in a standardized long-format dataset.
data - Input dataset.
class - Grouping (classification) variable with two levels.
var - Numeric analysis variable.
alpha - Significance level for confidence intervals (default: 0.05).
side - Test type for PROC TTEST:
2 = two-sided (default),
L = one-sided lower-tail,
U/R = one-sided upper-tail.
h0 - Null hypothesis mean difference (default: 0).
Welch - Whether to use Welch/Satterthwaite method:
Y = Welch t-test (default),
N = Pooled-variance t-test.
Outputs:
out - Output dataset in ARD-style structure with:
- estimate / conf.low / conf.high for each group mean
- estimate1 / estimate2 for group-specific means
- t statistic, degrees of freedom, p-value
- method, alternative, conf.level, mu, var.equal, paired
- Assumes exactly two groups in &class.
- One-sided direction depends on the ordering of CLASS levels in PROC TTEST.
- Intermediate datasets are created in WORK and deleted at the end.
%sard_stats_t_test(
data=ADSL,
out=sard_stats_t_test,
class=TRT01PN,
var=AGE,
alpha=0.05,
side=2,
h0=0,
Welch=Y
);
Performs Fisher's exact test for a 2x2 (or RxC) contingency table by
aggregating counts and calling PROC FREQ with the FISHER option.
The macro returns ARD-style p-value and method/alternative metadata.
data - Input dataset.
classdata - Optional CLASSDATA= dataset for PROC SUMMARY (formats/order).
group - Row (grouping) variable for the contingency table.
var - Column (categorical) variable for the contingency table.
side - Alternative hypothesis:
2 or B = two-sided (default),
L = one-sided (lower/left tail),
U or R = one-sided (upper/right tail).
out - Output dataset in ARD-style structure with: - method (Fisher's Exact Test) - alternative (two.sided / less / greater) - p.value (exact Fisher p-value)
- The meaning of "less" and "greater" depends on the ordering of levels in &group and &var as used in TABLES &group * &var.
- Missing values in &group or &var are excluded unless PROC SUMMARY is modified with MISSING.
- Intermediate datasets are created in WORK and deleted at the end.
%sard_stats_fisher_test(
data=ADSL,
out=sard_stats_fisher_test,
group=TRT01PN,
var=SEX,
side=2
);
0.1.0(03December2025): Initial version
The package is built on top of SAS Packages Framework(SPF) developed by Bartosz Jablonski.
For more information about the framework, see SAS Packages Framework.
You can also find more SAS Packages (SASPacs) in the SAS Packages Archive(SASPAC).
First, create a directory for your packages and assign a packages fileref to it.
filename packages "\path\to\your\packages";Secondly, enable the SAS Packages Framework. (If you don't have SAS Packages Framework installed, follow the instruction in SPF documentation to install SAS Packages Framework.)
%include packages(SPFinit.sas)Install SAS package you want to use with the SPF's %installPackage() macro.
-
For packages located in SAS Packages Archive(SASPAC) run:
%installPackage(packageName)
-
For packages located in PharmaForest run:
%installPackage(packageName, mirror=PharmaForest)
-
For packages located at some network location run:
%installPackage(packageName, sourcePath=https://some/internet/location/for/packages)
(e.g.
%installPackage(ABC, sourcePath=https://github.com/SomeRepo/ABC/raw/main/))
Load SAS package you want to use with the SPF's %loadPackage() macro.
%loadPackage(packageName)

