sas >> Scatterplot matrix from ODS in PROC CORR

by Paul » Fri, 26 Mar 2010 22:59:42 GMT

Hi there,

I'm trying to generate a scatterplot matrix using ODS in Proc Corr.
Works fine except that not all the variables appear in the matrix. It
seems capped at 5X5 when it should appear as a 9X9 matrix. From the
code below the scatterplot matrix that is generated by ODS includes
only (a_GLUCOSE_0, c_AMYLOID, e_CRP, f_HDL, g_INSULIN_0) however the
PROC CORR output includes all 9 variables...

ODS GRAPHICS ON;
PROC CORR DATA=MERGED PLOTS=scatter(ellipse=none) ;
VAR a_GLUCOSE_0
c_AMYLOID
e_CRP
f_HDL
g_INSULIN_0
h_LDL
i_TG
j_VDBP
k_VITD25 ;
TITLE 'Correlation calculations using PROC CORR';
RUN;
ODS GRAPHICS OFF;

any suggestions? Am I missing something?

thank you.

sas >> Scatterplot matrix from ODS in PROC CORR

by Paige Miller » Sat, 27 Mar 2010 00:47:16 GMT



> gt;c_AMYLOID
> gt;e_CR>
> f_>DL
> > g_INSULIN_>
> gt;h_LDL
> > i_TG
> j_VDBP
> gt;k_VIT>25 ;
> TITLE 'Corre>at>on calculations using PROC CORR';
> RUN;
>
> any suggestions? Am I missing something?
>
> thank you.

You need to look up and then use the NVAR and NWITH options.

Paige Miller
paige\dot\miller \at\ kodak\dot\com

Similar Threads

1. correlation scatterplot Matrix

Hello,
I am a novice user of sas and came across with the problem of
creating a scatter plot of longley data like we see all the charts
shown in a matrix form of 6x6 or 7x7. I have tried number of commands
but not having a much of luck.
There are 7 variables including the response variable.
x1....x63 and Y.

Q2: Also how do you get codes from the window base sas point of view as
compared to using the editor mode. I have not used the point and click
area for analysis. i use the editor window but on search for help I see
most of the information on window base sas. I am sure I could do the
ablove issue on window base but then how do I access the code?
Thanks for your help.
Aqeel

2. title in plots=matrix from proc corr

3. CORR matrix incomplete (proc factor error message)

Hi, SAS users
Thanks for your time and attention.

I have a problem with sas procedure "proc factor"--- from the
correlation matrix print outs , I think it is complete, but using the
correlation matrix in "proc factor" always gets me an error message
"ERROR: CORR matrix incomplete in data set WORK.D2."
( WORK.D2. is the name of the correlation output dataset).

* Operation System:
I am using SAS on a Linux 2.6.18-92.1.22.el5PAE platform;

Below is the basic structure of my SAS code. I started out with more
than three variables ,  suspecting it's the wired data structure, I
cut back to only three variables for trial and trouble shooting.

/* output correlation matrix to dataset called "cor" */
proc corr data=chdata  output=cor ;
  var v1~v9 ;
run;

/* initial trial on the correlation matrix */
proc factor data=cor;
run;

/* I got The error message "CORR matrix incomplete".*/

/* for trouble shooting, I keep three variables from the dataset "cor"
now called "d2" */

data d2  (TYPE=CORR);
set cor(keep = _TYPE_	_NAME_	v1 v2 v3);
where _NAME_ in ("v1","v2","v3" );

proc print data=d2;
run;

proc factor data=d2 ;
run;

/* I got The error message "CORR matrix incomplete" again.*/


/* This is the printed out "d2" */

Obs    _TYPE_       _NAME_           v1          v2          v3

 1      CORR             v1               1.00000     0.26606
-0.05052
 2      CORR             v2               0.26606     1.00000
-0.03753
 3      CORR             v3              -0.05052    -0.03753
1.00000

It seems to me the correlation matrix is complete, I don't understand
why it always gave me the error message "CORR matrix incomplete". I
googled but did not find much discussion on this question. Please let
me know if I need to supplement further information or try alternative
methods.

Thank you for your time!

Muriel

4. ODS and PROC CORR

5. Proc corr ods dropping p and n values

When I output proc corr (pearson) into an output dataset it
automatically gives me the p and n values as well.  Is there an option
that allows me to drop these as they are complicating matters for
later datsteps.  All I want is the pearson correlation coefficient.

I know not having the pvalues is dangerous but there are other checks
and balances going on later....

thanks
Matt

6. ods listing close failed to suppress proc corr output

7. ODS MACRO to reformat PROC CORR table

Hi SAS experts,

Any help with the following program would be appreciated. I have
included sample data and annotations so the program should run the same
as it does on my PC. I am trying to create a dataset with just a few
bits of key information that are derived from an ODS table from PROC
CORR. Alas, the parse macro does not yet deliver the desired reformatted
and streamlined information.

Thanks in advance,

Michael Murff
Provo, UT

/*** the purpose of this program is to create a new sas dataset based
on an ODS
         object in PROC CORR. The ODS table labeled "Pearson
Correlations" is written
         to a SAS dataset called test. This new dataset contains
bivariate correlations
        among all variables in the test dataset.

        The parsecorr macro tries to parse correlation data so that each
observation
        for a new dataset will contain information in the this form:

        var1 var2 pvalue correlation n
        var1 var3 pvalue correlation n
        var2 var3 pvalue correlation n
***/

/*** Create test data ***/
/*** variables should have different n ***/

data test;
        do i = 1 to 10;
                w = normal(2); output;
                do j = 1 to 2;
                        x = ranuni(2); output;
                        do k = 1 to 2;
                                y = normal(2); output;
                        end;
                end;
        end;
drop i j k;
run;

/*** Write pairwise correlation data to a new dataset ***/

ods listing close;
ODS OUTPUT pearsoncorr=testcorr;
PROC CORR data=test;
        var w x y;
run;
ODS OUTPUT CLOSE;
ods listing;

/*** Create macro vars for looping in parsecorr macro ***/

%LET numvar = 3;
%LET VAR1 = w;
%LET var2 = x;
%LET VAR3 = y;

/*** this is set low for testing ***/
/*** real cut levels will be lt .1 ***/
%LET cutpoint = .9;


/***
Condition output on
        1) a pvalue being less than some threshhold, say, .05, and
        2) do not include correlations of same var, like Corr(var1,
var1)
          since this is always eq to 1 and meaningless anyway.
***/
%macro parsecorr;
        %let ifirst = 1;
        %do i=1 %to &numvar;
                %do j=1 %to &numvar;
                /*** omit records that meet condition 2 (above) ***/
                        %if &i ne &j %then %do;
                                data test2;
                                        point = &i;
                                        /*** direct access set method
***/
                                        set test point = point;
                                        /*** threshhold from condition 1
***/
                                        if p&&var&j > &cutpoint then
do;
                                                call symput('flag',0);
                                                delete;
                                        end;
                                        else do;
                                                call symput('flag',1);
                                        end;
                                        stop;
                                run;
                                /*** create base dataset only once ***/
                                %if &flag eq 1 %then %do;
                                        %if &ifirst eq 1 %then %do;
                                                data test3;
                                                        set test2;
                                                run;
                                                %let ifirst = 0;
                                        %end;
                                        /*** now append each successive
dataset to the next ***/
                                        %else %do;
                                                proc append base = test3
data = test2 force;
                                                run;
                                        %end;
                                        %let i = %eval(&i+1);
                                %end;
                        %end;
                %end;
        %end;
%mend;

/*** NOT PRODUCING ANY OUTPUT ???? ***/
%parsecorr

8. PROC TABULATE/PROC FREQ - Save 2*2 matrices (Loan transition matrices)