Hi I was reading this interesting presentation on Many to Many merge without getting the error using temporary Arrays!!!
I am interested to know About the usage
array f{&fcount.,2} _temporary_; /*HOW and when can we use commas between the lower and upper bounds*/
Thanks
HOW and when can we use commas between the lower and upper bounds
How to define the number of dimensions and the lower and upper bounds for any dimension does not depend on whether the array is using normal variables or _temporary_ variables. The only restriction is that you must specify the bounds for temporary arrays as there is no way for SAS to count the number of variables to figure out the upper bound.
Dimensions are separated by commas in the definition and in any references in your program. If you want to use lower bounds that do not start with 1 then you can define that using : separator in the definition.
data third(keep=a b c);
array f{&fcount.,2}_temporary_; /*I guess this is the rows,cloumns...when dealing with large datasets how will we khow many columns&rows*/
do i=1 to &fcount.;
set first;
f{i,1}= A;
f{i,2}= B; /*array name and elements seperated by a comma???*/
end;
do i=1 to &scount.;
set second;
do j=1 to &fcount.;
if a=f{j,1} then
do;
b=f{j,2};
output;
end;
end;
end;
run;
It pays to be aware that temporary arrays are held in memory, so there are definite limits to their size. If you try to load a large dataset into a temporary array, say 1 million rows or more, then I suspect you will very soon get out of memory errors.
Where temporary arrays are really powerful, is in complex processing of small to medium size datasets, say thousands, to 100,000's of rows/columns.
Also remember that temporary arrays will not speed up the reading or writing of data to disk as these are limited by your io bandwidth.
HOW and when can we use commas between the lower and upper bounds
How to define the number of dimensions and the lower and upper bounds for any dimension does not depend on whether the array is using normal variables or _temporary_ variables. The only restriction is that you must specify the bounds for temporary arrays as there is no way for SAS to count the number of variables to figure out the upper bound.
Dimensions are separated by commas in the definition and in any references in your program. If you want to use lower bounds that do not start with 1 then you can define that using : separator in the definition.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.