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 1998, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 22 Oct 1998 16:25:11 GMT
Reply-To:     whiterr@MY-DEJANEWS.COM
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         whiterr@MY-DEJANEWS.COM
Organization: Deja News - The Leader in Internet Discussion
Subject:      Re: help with transforming correlation matrix

In article <7216EF1DF187D111A40500A0C9896EE5338F1A@ws11.kmv.com>, "Zhang, Jing" <jing.zhang@KMV.COM> wrote: > Dear All, > > I am wondering if anyone has done this before: > > I have a SAS output data set containing correlation matrix from PROC > CORR as following: > _TYPE_ _NAME_ VAR1 VAR2 .......... VAR100 > COR VAR1 1 0.45 ........... 0.65 > . 0.45 > . > . > COR VAR100 0.12 ............... 1 > I am trying to convert it to the following pair-wise correlation without > the "1"s and without the redundant correlation > in the following format: > > NAME1 NAME2 COR > VAR1 VAR2 0.45 > . . . > . . . > . . . > > VAR99 VAR100 ... > > I would appreciate very much any suggestions you may have, many thanks! > > Jing Zhang

Something like this (untested) might do the job:

DATA CORROUT(KEEP=NAME1 NAME2 COR); SET CORR(DROP=_TYPE_ RENAME=(_NAME_=NAME1)); ARRAY VAR[100] VAR1-VAR100; DO NUM=_N_+1 TO 100; COR=VAR[NUM]; OUTPUT; END;

This assumes you want the "triangle" VAR1*(VAR2-VAR100), VAR2*(VAR3-VAR100), VAR3*(VAR4-VAR100), ..., VAR98*(VAR99 VAR100), VAR99*VAR100.

Hope that helps, - Ray

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own


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