Help using Base SAS procedures

using proc corr for subcolumns within columns

Reply
Super Contributor
Posts: 401

using proc corr for subcolumns within columns

  Hi, so on to my explanation.  I'm trying to use proc corr (on any other correlation procedure) that I can correlated subcolumns within columns. This is a 2 PART question.

Part 1 :The data I have is as below and I'm trying to transpose it so it looks like WANT.. 

HAVE:

                                                                                                           

                                 Metric1    Metric2    Metric3   

COL1 SCol1 Group1

COL1 SCol2 Group1

COL1 SCol3 Group1 

COL1 SCol4 Group1 

COL2 SCol5 Group1 

COL2 SCol6 Group1 

COL2 SCol7 Group1 

COL2 SCol8 Group1

COL1 SCol1 Group2

COL1 SCol2 Group2

COL1 SCol3 Group2

COL1 SCol4 Group2 

COL2 SCol5 Group2 

COL2 SCol6 Group2 

COL2 SCol7 Group2 

COL2 SCol8 Group2 

WANT:                  

                                        COL1                                   COL2                                  

                          SCol1 SCol2 SCol3 Scol4     SCol5 SCol6 SCol7 SCol8    

Group1  Metric1

Group1  Metric2

Group1  Metric3

Group2  Metric1

Group2  Metric2

Group2  Metric3

Part 2 of this problem is that I would like to correlate the SCol's within each COL only. So for example only the SCol1-SCol4 would correlate, and same for SCol5-SCol8, as per their respective COL's.  thanks

PROC Star
Posts: 7,467

using proc corr for subcolumns within columns

I don't understand what you are trying to do.  Please some example data showing that the data initially looks like, how you want it to look, and what exactly has to be correlated with what.

Super Contributor
Posts: 401

using proc corr for subcolumns within columns

Ok, I'll try to simplify it a little:

HAVE:

                             UN_rt      /      Price

TO    SC  Model1      6.7            34.56

TO    SC  Model2      6.4            56.77

TO    NY  Model1      6.4            56.77

TO    NY  Model2      6.4            51.47

TO    ET   Model1      6.2            12.54

TO    ET   Model2      6.8            10.54

OTT  KN   Model1      7.3            37.45

OTT  KN   Model2      7.3            39.14

OTT  VN   Model1      7.4            55.76

OTT  VN   Model2      7.6            58.76

OTT  PK   Model1      7.1            11.65

OTT  PK   Model2      7.2            15.67

WANT:

                                     TO                             OTT

                             SC     NY     ET          KN      VN       PK

Model1  UN_rt       6.7      6.4     6.2          7.3      7.4       7.1 

Model2  UN_rt       6.4      6.4     6.8          7.3      7.6       7.2

Model1  Price      34.56   56.77  12.54      37.45   55.76    11.65

Model2  Price      56.77   51.47  10.54      39.14   58.76    15.67

Part 2, I want to correlate the subgroups (SC, NY and ET) within TO if there are any corrlations.  And same within the OTT group.

As an example, something like :

Group1 (SC+NY)

Group2 (ET)

Group3 (KN+PK)

Group4 (VN)

Super User
Posts: 19,770

using proc corr for subcolumns within columns

That looks like a transpose rather than correlation? Or is there something that needs to be calculated somwhere that I'm missing.

Ask a Question
Discussion stats
  • 3 replies
  • 109 views
  • 0 likes
  • 3 in conversation