turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Help on Proc Corr

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-19-2010 04:45 AM

Hi,

Following is the code I would be running :

proc corr;

var &var;

by segment;

run;

I am trying to find out which of my variables are highly correlated then store them in a dataset ...

Output data set I am interested in should show me something like:

Segment_Name Variables_name Correlation_value

a x1, x2 0.85

a x5, x3 0.92

b x2, x3 0.86

Is there any way I could work around in SAS and get this kind of output??

Following is the code I would be running :

proc corr;

var &var;

by segment;

run;

I am trying to find out which of my variables are highly correlated then store them in a dataset ...

Output data set I am interested in should show me something like:

Segment_Name Variables_name Correlation_value

a x1, x2 0.85

a x5, x3 0.92

b x2, x3 0.86

Is there any way I could work around in SAS and get this kind of output??

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-19-2010 10:04 AM

Hi:

ODS OUTPUT can create output datasets from SAS procedures, such as PROC CORR. However, PROC CORR has the OUTP= option, which will output just the Pearson Correlations to a dataset, as described here:

http://support.sas.com/documentation/cdl/en/procstat/63104/HTML/default/viewer.htm#procstat_corr_sec...

http://support.sas.com/documentation/cdl/en/procstat/63104/HTML/default/viewer.htm#procstat_corr_sec...

If you review the output from this program, you may find that it is close to what you want.

cynthia

[pre]

** 1) OUTP method;

** if SASHELP.CLASS is sorted by AGE, the BY variable.;

proc corr data=sashelp.class outp=work.outpmethod;

var height weight;

by age;

run;

proc print data=work.outpmethod;

run;

[/pre]

ODS OUTPUT can create output datasets from SAS procedures, such as PROC CORR. However, PROC CORR has the OUTP= option, which will output just the Pearson Correlations to a dataset, as described here:

http://support.sas.com/documentation/cdl/en/procstat/63104/HTML/default/viewer.htm#procstat_corr_sec...

http://support.sas.com/documentation/cdl/en/procstat/63104/HTML/default/viewer.htm#procstat_corr_sec...

If you review the output from this program, you may find that it is close to what you want.

cynthia

[pre]

** 1) OUTP method;

** if SASHELP.CLASS is sorted by AGE, the BY variable.;

proc corr data=sashelp.class outp=work.outpmethod;

var height weight;

by age;

run;

proc print data=work.outpmethod;

run;

[/pre]

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-20-2010 08:54 AM

Hello Lisa,

I prefer the ODS output since you get both the correlation coefficient and the p-Values in a single output dataset.

See my example below using the SASHELP.CLASS table.

proc sort data=sashelp.class out=class;

by sex;

run;

ods output PearsonCorr=Pearson_Corr ;

proc corr data=class Pearson;

var _numeric_;

by sex;

run;

Below is a link to all the ODS tables that can be produced from PROC CORR.

http://support.sas.com/documentation/cdl/en/procstat/63104/HTML/default/viewer.htm#procstat_corr_sec...

D

I prefer the ODS output since you get both the correlation coefficient and the p-Values in a single output dataset.

See my example below using the SASHELP.CLASS table.

proc sort data=sashelp.class out=class;

by sex;

run;

ods output PearsonCorr=Pearson_Corr ;

proc corr data=class Pearson;

var _numeric_;

by sex;

run;

Below is a link to all the ODS tables that can be produced from PROC CORR.

http://support.sas.com/documentation/cdl/en/procstat/63104/HTML/default/viewer.htm#procstat_corr_sec...

D