SAS PROC SQL UNION ALL-最小化列长度

SAS PROC SQL UNION ALL-最小化列长度,sas,union-all,proc-sql,Sas,Union All,Proc Sql,我有8个表,所有表都包含相同的顺序和列数,而一个名为ATTRIBUTE的特定列包含长度为4到25的不同数据。当我使用PROC SQL和UNION ALL表时,中的属性列数据长度最小化到最低(4位)。 如何解决这个问题,即保持数据的完整长度?例如,per@Lee data have1; attrib name length=$10 format=$10.; name = "Anton Short"; run; data have2; attrib name length=$50 fo

我有8个表,所有表都包含相同的顺序和列数,而一个名为ATTRIBUTE的特定列包含长度为4到25的不同数据。当我使用PROC SQL和UNION ALL表时,中的属性列数据长度最小化到最低(4位)。 如何解决这个问题,即保持数据的完整长度?

例如,per@Lee

data have1;
  attrib name length=$10 format=$10.;
  name = "Anton Short";
run;

data have2;
  attrib name length=$50 format=$50.;
  name = "Pippy Longstocking of Stoyville";
run;

* column attributes such as format, informat and label of the selected columns
* in the result set are 'inherited' on a first found first kept order, dependent on 
* the SQL join plan (i.e. the order of the tables as coded for the query);

proc sql;
  create table want as
  select name from have1 union
  select name from have2
  ;

proc contents data=want varnum;
run;
格式比长度短,任何较长值的输出显示将在数据级别被截断

示例,per@Lee

data have1;
  attrib name length=$10 format=$10.;
  name = "Anton Short";
run;

data have2;
  attrib name length=$50 format=$50.;
  name = "Pippy Longstocking of Stoyville";
run;

* column attributes such as format, informat and label of the selected columns
* in the result set are 'inherited' on a first found first kept order, dependent on 
* the SQL join plan (i.e. the order of the tables as coded for the query);

proc sql;
  create table want as
  select name from have1 union
  select name from have2
  ;

proc contents data=want varnum;
run;
格式比长度短,任何较长值的输出显示将在数据级别被截断


通常情况下,PROC SQL使用所有数据集的最大长度,因此长度应为25,但格式与第一个数据集保持一致,因此可以看到较少的字符。(或者是数字,如果它是一个数字变量,但长度超过25也不起作用)我只是使用了另一个数据集作为联合中的第一个数据集,所有这些数据集都设置了其余表的长度。谢谢我说的不完全是这个意思。它只设置格式!无论哪种方式-正常情况下,PROC SQL使用所有数据集的最大长度,因此长度应为25,但格式与第一个数据集保持一致,因此可以看到较少的字符。(或者是数字,如果它是一个数字变量,但长度超过25也不起作用)我只是使用了另一个数据集作为联合中的第一个数据集,所有这些数据集都设置了其余表的长度。谢谢我说的不完全是这个意思。它只设置格式!不管是哪种方式,它都奏效了