简体   繁体   中英

SAS Array Declaration

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?

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 with nexb . So the same as nexb1-nexb17 more than likely (without knowing what's in the datasets in the set statement though). It's identical, and just used to make it easier to change that 17 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 say nexb[1] instead of nexb1 , which is really more useful since [1] can be [i] or some other variable, while nexb1 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM