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


Hi I was reading this interesting presentation on Many to Many merge without getting the error using temporary Arrays!!!

http://www.sas.com/offices/asiapacific/sp/usergroups/snug/archive/2006/presentations/Q206StephenCrof...

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

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User
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.



View solution in original post

3 REPLIES 3
robertrao
Quartz | Level 8

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;

SASKiwi
PROC Star

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.

Tom
Super User Tom
Super User
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.



sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 733 views
  • 3 likes
  • 3 in conversation