Date: Tue, 22 Oct 1996 15:46:42 -0400
Reply-To: Ismail Parsa x6734 <sip@EPSILON.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Ismail Parsa x6734 <sip@EPSILON.COM>
Subject: Re: new proc corr question
|> From: "Karen L. Olson, Ph.D." <OLSON_K@A1.TCH.HARVARD.EDU>
|> Subject: new proc corr question
|>
|> I now want to print the zillion correlations I am calculating.
|> Thanks to Ian Whitlock, John Whittington, Jay Weedon, and others, the
|> typing I had to do to run the analyses was greatly reduced.
|>
|> On my final output, I want to print the correlation
|> values for males, the significance of these values, correl for females,
|> the significance of that, and the signif of the difference between
|> males/females.
|>
|> If I run proc corr by gender, I get my correl values and the exact
|> p values. However, when I save output to a file, there is no option to
|> save the p values. So I suppose I must calculate them.
|>
|> Does anyone have a formula to calculate these exact p values?
Karen the following code will do what you are asking. Just
save your proc corr results into a data set named _corr_ and
let it work out the P values for you.
Regards.
*-----------------------------*
| Ismail Parsa |
| Epsilon Data Management |
| 50 Cambridge Street |
| Burlington MA 01803 USA |
| |
| E-MAIL: sip@epsilon.com |
| V-MAIL: (617) 273-0250*6734 |
| FAX: (617) 272-8604 |
| |
| The Usual Caveat Applies |
*-----------------------------*
data _cr_c (drop=_name_) ; set _corr_ ; if left(upcase(_TYPE_)) = "CORR" ; run ;
data _cr_n (drop=_name_) ; set _corr_ ; if left(upcase(_TYPE_)) = "N" ; run ;
proc transpose data=_cr_c out=_cr_ct ( rename = ( col1 = _corr ) ) ; run ;
proc transpose data=_cr_n out=_cr_nt ( rename = ( col1 = _n ) ) ; run ;
data _pvals ; merge _cr_ct _cr_nt ; run ;
data _pvals ( rename = ( _name_ = _VARS_ )
keep = depvar _name_ _corr _PvalC_ _pctmiss _N ) ;
length depvar _name_ $8 ;
set _pvals ;
df = _n - 2 ;
crnum = (sqrt(_n - 2))*_corr ;
crden = sqrt(1-(_corr*_corr)) ;
crtrn = crnum / crden ;
_PvalC_ = (1-probt(abs(crtrn),df)) * 2 ;
depvar = upcase(left( "&depvar" )) ;
_pctmiss = 100 - ((_N / &__NOBS)*100) ;
format _PvalC_ 7.5 ;
run ;