首先要检讨一下,我英语不好,所以可能影响理解。以下一小段文字摘抄自SAS官方的书"Step-by-Step Programming with Base SAS Software":
Using the SET Statement When Variables Have Different Lengths
If you use the SET statement to concatenate data sets in which the same variable
has different lengths, then the outcome of the concatenation depends on whether the
variable is character or numeric. The SET statement determines the length of variables
as follows:
􀀀 For a character or numeric variable, an explicitly defined length overrides a
default, regardless of the position of the data sets in the SET statement.
􀀀 If two or more data sets explicitly define different lengths for the same numeric
variable, then the variable in the new data set has the same length as the variable
in the data set that appears first in the SET statement.
􀀀 If the length of a character variable differs among data sets, whether or not the
differences are explicit, then the variable in the new data set has the same length
as the variable in the data set that appears first in the SET statement
其第1条和第3条,是不是有矛盾的地方呢?
假如有两个数据集a和b,其各自唯一的文本型变量v,长度分别为默认的8和指定的10,那么:
data n
set a b;
run;
该如何处理n中v的长度?
按照第1条,由于b中v是指定的10,因此长度为10。按照第3条,不管是不是指定的长度,都按a的v长度8来。
到底按哪种方式处理呢?