Statistical Analysis Coding Project (solution) - Loyalty Program Analysis

[Note: you are recommended to copy and paste the code below onto your SAS Studio for better viewing]

Model Answer

proc sort data=loyalty;
by recency frequency;

** Coding Project **;
ods output statistics=stat ttests=ttests equality=equa;
proc ttest data=loyalty;
class group;
var spent;
by recency frequency;

data stat2;
set stat;
if class = "Diff (1-2)";
keep recency frequency class mean;

data combine;
merge stat2 ttests equa;
by recency frequency;
if probf < 0.05 and variances = "Equal" then delete;
else if probf > 0.05 and variances = "Unequal" then delete;

if probt<0.05;

keep recency frequency mean class probt;