> 1) GENERALITY OF CODE: If in your experience groups
> of BY variables are often of mixed types (numeric and
> character), then what I’m saying is true: my code is
> more general than Chung’s rewrite of your code, since
> his does not allow the by-variables to be of mixed
> (numeric and character) types (because he uses an
> ARRAY statement). Not “perhaps,” just a simple SAS
> fact.
It is clear that you don't understand how the programs presented by me and Chang work. The ARRAY is NOT an array of BY variables it is an ARRAY of FIRST variables. The data type of the BY variables is irrelevant.
There is potential for a problem using [pre]array f
first:;[/pre]vs[pre]array f 'first.'n:[/pre]the former having the possibility to include other variables that begin with FIRST that are not FIRSTdot. Both statements are shorthand for.
[pre]array f first.a first.b first.c;[/pre]
> 2) UNDERSTANDING: I understood exactly what you’re
> saying: yes, of course, as a general rule groups of
> BY variables of different types (numeric and
> character) can be used on BY or CLASS statements.
> Since my code handles that, clearly I did not think
> it was terribly uncommon, nor did I think it was a
> problem generally.
>
> However, there are cases where it can be a problem,
> so without pulling any muscles, I try to remain
> cognizant of that generally and generally try to
> avoid mixing. For example, I often use a macro
> variable to contain the names of a group of BY
> variable names (as I did in my macro – very common).
> But if I wanted to perform some repetitive operation
> on them in a data step, an ARRAY would be a likely
> choice, but I could not do so in an ARRAY statement
> if they are of mixed TYPEs.
>
> That’s just one example, so if a string of variable
> names are being used in macro variable, mixing the
> types CAN be a problem. So to the extent that it can
> trip up the unsuspecting code, it IS relevant.
You still don't get it. Why should BY variable TYPE matter. I do not have control over the TYPE of any variable that is not created by my program including the variables used in BY statements. Why should any program macro of otherwise ever by "tripped up" because one BY variable is numeric and another is character.
>
> 3) FORCING A SOLUTION TO USE ARRAYS: I think you are
> taking polingjw’s request way too literally.
> Polingjw is the only person who can confirm or deny
> this, but it was clear to me that s/he was more
> familiar with arrays and so wrote the “conceptual
> code” using arrays only to make the point (hence the
> disclaimer) that s/he wanted to process by-variables
> succinctly, but did not necessarily need the
> solution literally to use arrays. Rather, “Does
> anyone have any alternatives to make this code
> work?” to me means solve the problem of executing
> some code whenever hitting a first.var value. I
> whether or not a solution uses arrays is irrelevant.
I'm not forcing anyone to do anything. I was answering the question. You're the one going on about how your macros are better, while still not understanding the program I wrote. It appears that you do not fully understand what a FIRSTdot variable is and how it can be used.