Hello, I have created a 9801 by 201 array in a data step, but apparently this array is too large to be saved in SAS, i.e. there are too many variables for SAS to save all of them in a data set. The error message of SAS is the following: ERROR: Too many variables defined for file WORK.BLABLA. This file may not have more than 32767 variables. So I would like instead to convert this array into 201 variables each with 9801 records, but without having to leave the data step in which I define the array - the reason being that I cannot save the contents of my array. If the array is saved instead in 201 variables, it is possible for me to include the data in other data sets or sort it etc. Here's where I define my array (what my code does is not really important):
data _null_;
array a[9801,201];
do i = 2 to 100;
do j = 2 to 100;
n = 99*(i-2)+(j-1);
link fillArray;
end;
end;
return;
fillArray:
a[n,201] = i;
do k = 2 to j;
do x = 201 to 1 by -1;
if a[n,x] = . then leave;
a[n,x] = a[n,x]*i;
end;
do y = 201 to 1 by -1;
if a[n,y] = . then leave;
if a[n,y] ge 10 then do;
a[n,y-1] = sum(a[n,y-1],floor(a[n,y]/10));
a[n,y] = a[n,y] - floor(a[n,y]/10)*10;
end;
end;
end;
return;
run;
... View more