LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 1996, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments: To: OLSON_K@A1.TCH.HARVARD.EDU

|> 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 ;


Back to: Top of message | Previous page | Main SAS-L page