Subject: Re: SASTip: ATTRIB allows association and repetition
Respondent: Ian Whitlock <email@example.com>
In response to Spencer Hudson's <firstname.lastname@example.org> comment
> Interesting, the method also works for overlapping groups and
> for name range lists based on position in the PDV:
on Karsten M. Self's <kmself@IX.NETCOM.COM> revelation that the
variable specification on the ATTRIB statement can accept lists
> Right. The gist of my comment was that a variable could appear
> multiple times, whether implicitly (listed) or explicitly
> (enumerated) mentioned in the ATTRIB statement, and that the
> _last_ appearance for a _specific_ attribute (length, label,
> format, informat) would take precedence.
One has to be careful here. ATTRIB is nothing special, it follows
the standard SAS set up for variable properties. Numeric variable
length is determined by the last explicit specification and
character variable length is determined by the *first*
specification. (Note: Formats will determine character length.) The
reason is that all numeric variables are handled as 8 byte variables
during the DATA step, hence the compiler can let the last
specification win, but character length is set with the first
implicit length specification because it is handled that way during
DATA step processing.
Grouping like variables is fine, but I would not suggest allowing
overlapping groups without taking more pains than it is worth.