I was reading the SAS code for calculating NBBO, and I came across the following code:
array nexb nexb:; array nexo nexo:; array sexb sexb:; array sexo sexo:;
I was wondering what does the statement array nexb nexb:;
do here?
I was reading the SAS code for calculating NBBO, and I came across the following code:
array nexb nexb:; array nexo nexo:; array sexb sexb:; array sexo sexo:;
I was wondering what does the statement array nexb nexb:;
do here?
Copyright © 2021 Jogjafile Inc.
Two things:
nexb:
is a variable list with a wildcard. It expands to the list of all variables on the PDV at that point in the data step that begin withnexb
. So the same asnexb1-nexb17
more than likely (without knowing what's in the datasets in theset
statement though). It's identical, and just used to make it easier to change that17
sometime later without having to do so twice.array nexb nexb:
creates an array, which is simply an organized variable list that allows you to saynexb[1]
instead ofnexb1
, which is really more useful since[1]
can be[i]
or some other variable, whilenexb1
cannot. So it allows you to go through a list of variables one at a time and use them or change them. The array does not exist in the dataset itself and is not persistent, it's just a shorthand way to refer to the variables.