Solved
Contributor
Posts: 20

# Creating a data of pairs

Hi all,

I have a data whose number of variables is over 1,000.

Since the number of variables is too large to process the analysis that I am going to use,

me and my collage decided to reduce the number of variables using correlations.

We already created the correlations between the variables and extract some parts of the data (which have 0.8 or greater correlation)

and created a table which only have the pairs of the variables.

The data that I currently have looks like..

x   y

2   1

3   1

5   1

6   2

1   2

7   2

5   2

3   2

1   3

2   3

8   3

......

But it is hard to see which variables are paired up with this data( due to the large number of observation)

I want to create a table which looks like

group   pair1   pair2   pair3 pair4  ....

1           2         3        5     .

2           6         7       5       3

3           8        .      .          .

.....

which shows us which variables are paired up more clearly.

But I do not have any idea how to start it.

Can anyone give me some advice?

There are over 700,000 observations in this data

Accepted Solutions
Solution
‎03-27-2013 10:32 AM
Posts: 4,919

## Re: Creating a data of pairs

This should do it :

proc sort data=pairs; by x y; run;

data pairList;
length group 8;
array pair{100};
do i=1 by 1 until(last.x);
set pairs; by x;
group=x;
pair{i} = y;
end;
drop i x y;
run;

PG

PG

All Replies
Solution
‎03-27-2013 10:32 AM
Posts: 4,919

## Re: Creating a data of pairs

This should do it :

proc sort data=pairs; by x y; run;

data pairList;
length group 8;
array pair{100};
do i=1 by 1 until(last.x);
set pairs; by x;
group=x;
pair{i} = y;
end;
drop i x y;
run;

PG

PG
Contributor
Posts: 20

## Re: Creating a data of pairs

Thank you so much!

I works really well!

🔒 This topic is solved and locked.