BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
indra1975
Fluorite | Level 6

I am trying to create a large matrix 6400 x 288 with the following code:

 

options compress=yes;
data test;
set _null_;
array col(288);
i=1;
do until (i = 6400);
j=1;
do until (j = 288);
col{j}=0;
output;
j=j+1;
end;
i=i+1;
output;
end;
drop i j;
run;

Output Log:

The data set WORK.TEST has 0 observations and 288 variables.

 

Can someone please help me with improving the above code so that I get 6400 rows and 288 columns? Thanks in advance.

 

bests

ic

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20
data test(drop= i j);
   array col{288};
   do i=1 to 6400;
      do j=1 to 288;
         col[j]=0;
      end;
      output;
   end;
run;

View solution in original post

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20
data test(drop= i j);
   array col{288};
   do i=1 to 6400;
      do j=1 to 288;
         col[j]=0;
      end;
      output;
   end;
run;
indra1975
Fluorite | Level 6

Thank you. This works as intended.

PeterClemmensen
Tourmaline | Level 20

No problem. Glad you found your answer 🙂

PeterClemmensen
Tourmaline | Level 20

Also, this is simpler btw 🙂

 

data test(drop= i);
   array col{288} (288*0);
   do i=1 to 6400;
      output;
   end;
run;