What are the SAS Array Functions?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #49303
    rlochan2021
    Keymaster

    ARRAY FUNCTIONS- three SAS functions that i know related to SAS arrays

    Function Definition
    Dim( arrayname ) Returns the number of array elements
    Lbound( arrayname ) Returns the lowest subscript
    Hbound( arrayname ) Returns the highest subscript

    #49306
    rlochan2021
    Keymaster

    VNAME Function

    You can use the VNAME function to identify the name of a variable that is associated with an element of an array. The name
    of the array, along with the element number that appears within brackets, is passed as the single argument to the VNAME
    function, as shown in this example:

    array my_array[*] A B C;
    i=2;
    var_name=name(my_array[i]);
    In this case, the value of the VAR_NAME= variable is B.

    #49311
    rlochan2021
    Keymaster

    array structure :–

    array x{5,3} score1-score15;
    As an alternative, this ARRAY statement is a longhand version of the previous example:
    array x{1:5,1:3} score1-score15;

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.