Date: Thu, 10 Nov 2005 13:41:11 -0800
Reply-To: David L Cassell <davidlcassell@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David L Cassell <davidlcassell@MSN.COM>
Subject: Re: proc freq to find variable most correlated to x
In-Reply-To: <200511100015.jA9MwTVG002426@malibu.cc.uga.edu>
Content-Type: text/plain; format=flowed
davefickbohm@YAHOO.COM wrote:
>I want to use proc freq to find among variable X what other variable, A,B
>or C is most correlated to Y.
>I think that the following will do this.
>
>proc freq data = xxx;
> tables Y * (a,b,c) / measures;
>where x = 1;
>run;
>
>Am I correct ?
I'm not sure. It seems to me that by fixing the level of X (with that WHERE
statement) you may be missing a lot of the features of the relationships
with Y.
Are you saying that you would like to look at the correlations while
controlling for
the effect of X? In that case, I would go with PROC CORR instead. I would
use
the PARTIAL statement to get the partial correlations of Y with {abc} while
adjusting
for X. This is really like regressing all the variables on X, then looking
at the correlation
of the residuals for Y on the residuals for {a b c}. The code would look
like this:
proc corr data=YourData;
var Y;
with a b c;
partial X;
run;
And if you're running on SAS 9.1, you can use the SAS ODS Statistical
Graphics to
get plots of the partial residuals, to see what the data are *really* doing.
The code
would look *something* like this:
ods html;
ods graphics on;
proc corr data=YourData plots=scatter(alpha=.10 .30);
var Y;
with a b c;
partial X;
run;
ods graphics off;
ods html close;
The PLOTS=SCATTER above will give you 70% and 90% prediction ellipses
superimposed on your plots, along with the points.
Oh, by the way, if you want to use PROC FREQ as above, you need to replace
the commas in (a,b,c) with spaces:
tables Y * (a b c) / measures;
HTH,
David
--
David L. Cassell
mathematical statistician
Design Pathways
3115 NW Norwood Pl.
Corvallis OR 97330
_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/