@RW9: As I see it, an array is a list of variables which can (individually) be referenced by the array name followed by a subscript in brackets (or parentheses or curly brackets ...) after the array has been defined, but only within the same data step (and not in DROP/KEEP/RENAME statements or the corresponding dataset options). In a _TEMPORARY_ array, these variables (!) exist only during the data step where the array is defined (and can only be referenced using the subscript notation, are automatically retained, but not written to the output dataset).
In an array definition like array sq_{3} 8; (no need for a period after the 8 -- it's the length, not a format) the list of variables is implicitly defined by default as sq_1, sq_2, sq_3. In a definition like array aq_{*} vara varxyz abc; the list of variables is explicitly defined. Special variable lists such as vara--abc or c: or _numeric_ require the existence of corresponding variables in the PDV. In these cases the order of ARRAY and, e.g., SET statement is important.
In all cases where the list of variables does not require the existence of the variables in the PDV, one of the following two cases applies to each variable in the list:
the variable exists in the PDV: then it can henceforth (but only within the same data step, and see further restrictions above) be referenced as the respective array element, i.e. with the subscript notation like aq_{2}
the variable does not exist in the PDV: then it is created as a new variable (and can be referenced ... as above)
So, in your first example, array aq_{*} vara--abc; just enables you to refer, e.g., to the existing variable abc as aq_{3} (but not as aq_3, there is no such variable in the PDV!), this is case 1. Since dataset HAVE does not contain variables sq_1, sq_2, sq_3, the array definition array sq_{3} 8; creates new variables (i.e. adds them to the PDV) with those default names, this is case 2. The new variables are by default kept in the output dataset, like any other new variables.
I think, the above explains already why the second example (with keep=sq_:) does not work: There is no variable whose name starts with sq_ in the PDV and the KEEP= option would not even accept a reference like sq_{1} (with the intention to keep variable vara).
There seems to be no option to kind of duplicate a list of existing variables, so that array aq_{*} option vara--abc; would create new variables aq_1, ... with the same values as vara, ... Instead, it's either case 1 or case 2 that applies to each individual variable in the list. In the definition array aq_{*} vara newvar abc; case 1 would apply to vara and abc and case 2 to newvar (i.e., a new variable newvar would be created). If dataset HAVE happened to contain variables sq_1 and sq_3, but not sq_2, the statement array sq_{3}; would create only one new variable, sq_2.
... View more