The answer is the same as last time you asked, but replace the word 'Pearson' by 'Spearman.'.
See https://communities.sas.com/t5/SAS-Procedures/add-p-values-to-output-dataset-of-proc-corr/m-p/430081
If I may suggest, it will be easier to ask and answer questions if you post code that uses one of the built-in SAS data sets in the SASHELP libref. See also the SAS/STAT data sets.
My favorites in Sashelp are Class,Cars, Heart, and Iris. You can use PROC CONTENTS to see the variables and PROC PRINT (OBS=5) to see a few records.For example, here is your solution using Cars:
proc sort data=sashelp.cars out=cars;
by origin;
run;
ods exclude all;
proc corr data=cars Spearman;
ods output SpearmanCorr=P;
var mpg_city weight;
by Origin;
run;
ods exclude none;
proc print data=P; run;
... View more