Date: Tue, 10 Apr 2001 10:00:41 +0200
Reply-To: Gijs Dekkers <gd@PLAN.BE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gijs Dekkers <gd@PLAN.BE>
Organization: planbureau / bureau de plan
Subject: 2nd question on PROC CORR
Content-Type: text/plain; charset=us-ascii
Dear fellow SAS-users,
Another question on PROC CORR, I'm afraid.
I have two variables SCV1 and SCV2, and I use proc corr to derive the
correlation coefficient. But I want to destillate this one figure from
the outputfile generated by this procedure.
I have used the following datasteps, but this is not good, because it
does not always work. Sometimes, the variables COL1 (see below) is
missing.
So, the question is: how can I destillate just the one correlation
coefficient from the output-file of the PROC CORR-statement?
Any help would be greatly appreciated.
Gijs Dekkers
===
Proc Corr data=alles out=f3 ;
var SCV1 SCV2 ;
run ;
data f3 ;
set f3 ;
drop SCV2 ;
if (_NAME_='SCV2') then output ; /* _name_ <> varname.
Otherwise corr=1 */
PROC TRANSPOSE OUT=TEMP;
BY _NAME_ ;
PROC SORT OUT=TEMP;
BY _NAME_;
PROC TRANSPOSE DATA=TEMP OUT=FINAL;
VAR COL1; /* this one is not always there */
BY _NAME_;
RUN;
data corrl ;
set final ;
CRR=COL1 ;
drop COL1 ;
--
dr. Gijs Dekkers
Federaal Planbureau
Algemene Directie
Kunstlaan 47-49
B 1000 Brussel
++32/(0)2/5077413
fax 7373