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
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;
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;
Thank you. This works as intended.
No problem. Glad you found your answer 🙂
Also, this is simpler btw 🙂
data test(drop= i);
array col{288} (288*0);
do i=1 to 6400;
output;
end;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.