BookmarkSubscribeRSS Feed
rajeshalwayswel
Pyrite | Level 9

According my knowledge :

 

Implicit array : we cannot control it always increment by 1 (do over).

 

Explicit array : we can control it by iteration..

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

There are a few papers out on the subject:

http://support.sas.com/resources/papers/proceedings10/209-2010.pdf

http://www2.sas.com/proceedings/sugi30/242-30.pdf

 

These can describe better than a post.  Also the SAS documentation is there to provide instructions.

Reeza
Super User

DO OVER is deprecated like 20 years ago. People still use it, but you should use the explicit version instead. 

 

SAS maintains its functionality for backwards compatibility but there's a reason you didn't find it in the documentation.

Tom
Super User Tom
Super User

Not quite right. With EXPLICIT array reference you include the array index value when you reference the array.  So you would use references like 

do i=1 to dim(x);
  x(i) = x(i) *100;
end;

With IMPLICIT array reference the index value is always in the same variable (default variable is _I_) and if you want to change which element in the array your reference means you change the value of that specific variable.  So you do not add anything in the statement that references the variable.

do _i_=1 to 5 ;
  x = x * 100;
end;

or 

do over x ;
  x = x *100;
end;

Not sure why SAS has dropped the DO OVER from the manuals. Personally I feel it is much clearer when you want to apply the same operation to every element in the array.  Especially when the index has no meaning of its own, for instance if the elements in the list are not ordered in any meaningful way. 

 

Perhaps they feel it is too hard for the compiler to tell which references are array references if you use implicit array references?  Or feel it is too confusing for programmers.

 

The main thing to know is that for each array you have to stick with just one method of referencing it.  You can't use implicit in one statement and explicit in another statement.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 5665 views
  • 2 likes
  • 4 in conversation