Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Introduction

Although there are only three array functions, chances are you will need to use some or all of them if you use arrays in your programs. They are all used either to determine the number of elements in, or the upper and lower bounds of, a SAS array.

Function:DIM
 When you define an array, you can either enter the number of elements in the array in parentheses (or square or curly brackets) following the array name or you can use an asterisk (*) to indicate that you don't care to count the number of elements (perhaps you are "counting challenged"). SAS programmers often use an asterisk in place of the number of array elements when the list of variables is very long or where they are using keywords such as_CHARACTER_or_NUMERIC_in place of the list of variables. However, when you want to use a DO loop to process all the elements of the array, you need to know the number of elements. Here is where the DIM function comes in handy. It returns the number of elements in an array, given the array name as its argument.
Purpose:To determine the number of elements in an array.
Syntax:DIM (array-name<,dimension>)
 or
 DIMn(array-name) where n is a dimension of a multidimensional array
 array-name is the name of the SAS array for which you want to determine the number of elements.



  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint