Help using Base SAS procedures

proc corr p-values not showing and Pearson output missing

Reply
anonymous_user
Posts: 0

proc corr p-values not showing and Pearson output missing

I recently used the spearman and noprob options in a proc corr statement. Now when I use proc corr for other data without those options, SAS will not give me p-values in the results and only runs Spearman correlations instead of Pearson correlations. Is there a way to reverse these options? It appears that using them once permanently affected my SAS output.

Trusted Advisor
Posts: 1,270

Re: proc corr p-values not showing and Pearson output missing

Posted in reply to anonymous_user

Hi,

 

Something like this?

 

Without probability

 

proc corr data=sashelp.cars spearman noprob;
var horsepower mpg_highway;
run;

 

With probability

 

proc corr data=sashelp.cars spearman;
var horsepower mpg_highway;
run;

anonymous_user
Posts: 0

Re: proc corr p-values not showing and Pearson output missing

Right, so what I am saying is I ran the first code that you provided above to get spearman estimates without p-values. But then when I tried to run a proc corr on new data where I wanted pearson estimates and p-values, i still got spearman output and p values were not available. My problem is that the original code that i ran including spearman and noprob somehow permanently turned off pearson estimates and p-values for my future proc corr statements. 

Trusted Advisor
Posts: 1,270

Re: proc corr p-values not showing and Pearson output missing

Posted in reply to anonymous_user

I don't think noprob is a system option. If this is a system options then it will affect subsequent analysis.

 

proc options;

run;

 

and this works for new data as well.

 

New data - With probability


proc corr data=sashelp.class spearman;
var height weight;
run;

SAS Super FREQ
Posts: 502

Re: proc corr p-values not showing and Pearson output missing

As @stat_sas says, NOPROB is not a system option, and it cannot be retained for future analyses.  I am guessing the following: you made a mistake in your second PROC CORR run, you did not look in the log an see that mistake, and all you see is the same output without probabilities in the results window.  Check your log and/or try it in a new SAS session.

anonymous_user
Posts: 0

Re: proc corr p-values not showing and Pearson output missing

Posted in reply to WarrenKuhfeld

This is a new sas session. That is why im confused and thought it might be a system option. 

SAS Super FREQ
Posts: 502

Re: proc corr p-values not showing and Pearson output missing

Posted in reply to anonymous_user

Without seeing your log, no one can help you.

Super User
Posts: 13,563

Re: proc corr p-values not showing and Pearson output missing

Posted in reply to anonymous_user

Show the code and any messages from the log that does not create the desired output.

anonymous_user
Posts: 0

Re: proc corr p-values not showing and Pearson output missing

proc phreg data = fram;

model timemi*hospmi(0) = diabetes;

output out = residuals2 ressch = sh_diabetes;

run;

data failures2;

set residuals2;

where hospmi = 1;

run;

proc rank data = failures2 out = ranked2 ties = mean;

var timemi;

ranks timerank;

run;

proc corr data = ranked2 pearson nosimple;

with timerank;

var sh_diabetes;

run;

 

22 proc phreg data = fram;

23 model timemi*hospmi(0) = diabetes;

24 output out = residuals2 ressch = sh_diabetes;

25 run;

NOTE: Convergence criterion (GCONV=1E-8) satisfied.

NOTE: The data set WORK.RESIDUALS2 has 4240 observations and 40

variables.

NOTE: PROCEDURE PHREG used (Total process time):

real time 0.59 seconds

cpu time 0.18 seconds

 

26 data failures2;

27 set residuals2;

28 where hospmi = 1;

29 run;

NOTE: There were 363 observations read from the data set WORK.RESIDUALS2.

WHERE hospmi=1;

NOTE: The data set WORK.FAILURES2 has 363 observations and 40 variables.

NOTE: DATA statement used (Total process time):

real time 0.04 seconds

cpu time 0.00 seconds

 

30 proc rank data = failures2 out = ranked2 ties = mean;

31 var timemi;

32 ranks timerank;

33 run;

NOTE: The data set WORK.RANKED2 has 363 observations and 41 variables.

NOTE: PROCEDURE RANK used (Total process time):

real time 0.17 seconds

cpu time 0.00 seconds

 

34 proc corr data = ranked2 pearson nosimple;

35 with timerank;

36 var sh_diabetes;

37 run;

NOTE: PROCEDURE CORR used (Total process time):

real time 0.04 seconds

cpu time 0.01 seconds

 

the output gives a correlation but no p-value underneath

SAS Super FREQ
Posts: 502

Re: proc corr p-values not showing and Pearson output missing

Posted in reply to anonymous_user

I wonder if you are using a modified template.

proc template;
 list base.corr.StackedMatrix;
 list common.StackedMatrix;
 source base.corr.StackedMatrix;
 source base.corr.StackedMatrix;
quit;

Does your log look something like this?  Are the templates coming from sashelp?  If not, submit those steps substituting delete for source and try again.

40   proc template;
41    list base.corr.StackedMatrix;
42    list common.StackedMatrix;
43    source base.corr.StackedMatrix;
define table Base.Corr.StackedMatrix;
   notes "Default CORR stacked matrix";
   column (RowName RowLabel) (Matrix) * (Matrix2) * (Matrix3) * (Matrix4);
   translate _val_=._ into "";

   define RowName;
      varname = Variable;
      parent = Common.Column.RowName;
   end;

   define RowLabel;
      varname = Label;
      parent = Common.Column.RowLabel;
   end;
   parent = common.stackedmatrix;
   split_stack = OFF;
end;
NOTE: Path 'Base.Corr.StackedMatrix' is in: SASHELP.TMPLBASE (via SASHELP.TMPLMST).
44    source base.corr.StackedMatrix;
define table Base.Corr.StackedMatrix;
   notes "Default CORR stacked matrix";
   column (RowName RowLabel) (Matrix) * (Matrix2) * (Matrix3) * (Matrix4);
   translate _val_=._ into "";

   define RowName;
      varname = Variable;
      parent = Common.Column.RowName;
   end;

   define RowLabel;
      varname = Label;
      parent = Common.Column.RowLabel;
   end;
   parent = common.stackedmatrix;
   split_stack = OFF;
end;
NOTE: Path 'Base.Corr.StackedMatrix' is in: SASHELP.TMPLBASE (via SASHELP.TMPLMST).
45   quit;
NOTE: PROCEDURE TEMPLATE used (Total process time):
      real time           0.04 seconds
      cpu time            0.03 seconds


Ask a Question
Discussion stats
  • 9 replies
  • 515 views
  • 0 likes
  • 4 in conversation