ARRAYS in SAS University Edition Day 29 || ONE-DIMENSION & TWO-DIMENSIONAL ARRAYS in SAS

Поділитися
Вставка
  • Опубліковано 19 вер 2024
  • Simplifying Programs with Arrays:
    Sometimes you have to do the same action on more than one variable at a time.
    Although you can process the variables individually, by writing a series of
    assignment statements or IF statements., but it is typically easier to handle the
    variables as a group.
    Defining an Array
    A SAS array is a temporary grouping of SAS variables under a single name.
    ARRAY statement can be used only in the DATA step.
    Syntax:
    ARRAY name (n) variable-list;
    name is a name you give to the array
    n is the number of variables in the array.
    Variable-list is the list of variable names grouped together to
    form the array. The array Variable-list must be either all
    numeric or all character
    Rules for Creating the Array names:
    The rules for naming arrays are the same as those for naming variables,
    (must be 32 characters or fewer
    start with a letter or underscore followed by letters, numerals, or underscores).
    Arrays are of two types:
    One-Dimensional arrays: Runs the process depending on column
    Syntax: ARRAY name (n) variable-list;
    Two-Dimensional arrays: Runs the process depending on columns and rows
    Syntax: ARRAY name (n, m) variable-list1 Variable-list2;
    n- defines how many number of variable-lists in array statement
    m- defines how many variables in each variable-list
    Special Cases:
    In some cases, you could also consider using the special name lists ALL_,
    _CHARACTER and _NUMERIC_:
    Use ALL when you want SAS to use all of the same type of variables (all numeric or
    all character) in your SAS data set.
    Use CHARACTER when you want SAS to use all of the character variables in your
    data set.
    Use NUMERIC when you want SAS to use all of the numeric variables in your data
    set.
    Using temporary in Arrays:
    By using this we can assign multiple values to different variable missing values
    Creating new variables in SAS Array statement:
    We can also create new variables in an ARRAY statement by creating a new array
    statement in the program.
    Using * and dim functions in array:
    *:
    will count the number of variables included in the variable-list
    Dim:
    It requires array name as an argument and returns number of the variable list to
    control loop processing.
    Dim(Array_name)

КОМЕНТАРІ • 8

  • @avnishsingh6085
    @avnishsingh6085 4 роки тому +3

    great job chandana. very nicely you have covered the array concepts which many people feel afraid of and don't prefer to use it.

  • @kandukurisowmya2353
    @kandukurisowmya2353 6 місяців тому

    Crystal clear explanation....thank you so much

  • @Ranjithkumar-bu3eq
    @Ranjithkumar-bu3eq 3 роки тому +2

    tq chandana ......for ur valuable info

  • @TheSafi4027
    @TheSafi4027 2 роки тому +2

    great job...Nicely explained...

  • @Peaceful_Talk
    @Peaceful_Talk 5 місяців тому

    Perfect🎉

  • @nmesram
    @nmesram 5 місяців тому

    Are u starting course mam