BookmarkSubscribeRSS Feed
sultan_alhothli
Calcite | Level 5

Welcome Rick Wicklin, FD
I am a master's student in mathematical statistics ..
I have a problem in the formation model to calculate the Spearman coefficient of permutations (manual means without the use of Spearman coefficient of built-in device)
I arrived for this model .. And stood in the programming Spearman coefficient ..

DM 'LOG; CLEAR; OUTPUT; CLEAR;';
% let n = 3;
data perm & n (drop = i);
array a {& n};
do i = 1 to &n; a = i;
end;
do i = 1 to fact (& n);
    call allperm (i, of a

  • );

  •     output;
    end;
    run;
    proc print data = perm &n;
    proc iml;
    use perm &n;
    read all var {a1 a2 a3} into b;
    print b;
    run;
    quit;

    I hope to help you ..

    Thanks in advance for your cooperation ..

    Every year, you are fine ..

    3 REPLIES 3
    Rick_SAS
    SAS Super FREQ

    The Spearman correlation is just the Pearson correlation of the ranks. For your permutation data, the ranks of the data equals the data themselves, right? So the Spearman correlation of the permutations is identical to regular Pearson computation.

    To see this, run the following:

    ods select PearsonCorr SpearmanCorr;

    proc corr data = perm&n pearson spearman;

    run;

    Presumably you are familiar with how to compute the Pearson correlation manually. If not, see any textbook, or the doc for the CORR procedure.

    sultan_alhothli
    Calcite | Level 5

    First: Happy new year to you ..

    Secondly, thank you for your response objective ..

    I my English a little bit weak .. I hope that is not affected in the delivery of my idea to you ..

    1) I do not want to use the built-in Spearman coefficient within the SAS ..

    I know the method of calculating the Spearman coefficient manually .. but when you have been applying method in Alsace in standing problem while Calculate the difference between the first row and the rest of the rows ..

    2) What is the method to use ( do loop ) in ( proc iml ) ?

    sas-innovate-2024.png

    Don't miss out on SAS Innovate - Register now for the FREE Livestream!

    Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

     

    Register now!

    Multiple Linear Regression in SAS

    Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

    Find more tutorials on the SAS Users YouTube channel.

    From The DO Loop
    Want more? Visit our blog for more articles like these.
    Discussion stats
    • 3 replies
    • 963 views
    • 0 likes
    • 2 in conversation