I am looking for a script that will automatically generate a summary/pivoted table of means and p-values for pairwise t-tests compared with one reference group. I am using JMP 17.
In the below data table, there are columns for SubjectId, measured BMI, measured VO2max, year, and Reference to indicate whether or not the row has a SubjectID that is a reference.

I have been generating summary tables manually (like the below) with means and then manually populating p-values for the one-sided t-tests.

I am interested specifically in the one-sided p-value results of a t-test between each SubjectID against the reference for each year to determine whether or not the non-reference SubjectID has a higher BMI or VO2max than the reference SubjectID. So far, I have been manually performing a pooled t-test and reporting the p-value and mean in a summary table I have created. Is there a way to iterate over a list of unique SubjectIDs and generate a summary table with these statistics performed in the way described using JSL? Additionally, a generalized way to add summary statistics (e.g. N for each SubjectID for each analysis) would be helpful.