column vector to matrix

Reply
Occasional Contributor
Posts: 8

column vector to matrix

Hello I have following data (column vector)

1

2

3

.

.

1060

1061

.

.

.

530000

I want to make it

500*1060 matrix.

Any help appreciated.

Super Contributor
Posts: 1,636

Re: column vector to matrix

data have;

do i=1 to 530000;

output;

end;

data want;

  set have;

   group=int((_n_-1)/1060);

proc transpose data=want(keep=colSmiley Happy;

var i;

by group;

run;

proc print;run;

Respected Advisor
Posts: 4,646

Re: column vector to matrix

Be careful what you wish for... Smiley Happy

data have;
do i=1 to 500*1060;
output;
end;
run;

data want;
array x{500, 1060};
do k = 1 to 500;
     do j = 1 to 1060;
          set have;
          x{k,j} = i;
          end;
     end;
drop i j k;
run;

PG

PG
Ask a Question
Discussion stats
  • 2 replies
  • 227 views
  • 0 likes
  • 3 in conversation