I am trying to make a program to calculate Spearman's rho with ties. The easiest way is just to use Pearson correlation on the ranks of the variables. One can get the Pearson correlation from the LinRegTTest program available on the Stats > Tests. However, I would like to have a custom Spearman rho that would do two things:

1. Rank the observations (with ties) (there's a ZZRANK program in the forum to do that)

2. apply the LinRegTTest to ranked Lists and retrieve the "R" , "T" and "p" statistics from the linRegTTest.

Now, I don't know how to call the LinRegTTest from within a program and how to recover the statistics of interest.

Any help will be appreciated!