当试图合并的SAS数据集我不断收到以下错误的一些变量:如何避免SAS中的此错误?
列115 OUTER UNION的第一个贡献是不能从第二
相同类型作为其 对应
我已经能够解决这个错误通常通过执行以下操作:
改变变量的相同的“类型”之一其他。例如,将变量A从数字类型更改为字符类型,以便它与其他数据集中的变量匹配,从而允许合并发生。
导入我试图合并为CSV文件的数据集,然后在proc导入步骤中添加“猜测行”选项。例如:
proc import datafile='xxxxx'
out=fadados
dbms=csv replace;
getnames=yes;
guessingrows=200;
run;
然而,有时尽管导入我的文件,CSV格式,并使用“guessingrows”的我仍然得到上面的错误,有时有这么多,这是很费时并且不可能将所有变量实际转换为相同的“类型”,以便它们在数据集之间匹配。
任何人都可以告诉我如何轻松避免这个错误?人们是否有另一种方法来解决这个问题?我经常得到这个错误,我厌倦了必须转换每一个变量。必须有另一种方式!
******更新***** 下面是一个例子,每个人都在问的:如果没有一个例子是很难测试
proc sql;
title 'MED REC COMBINED';
create table combined_bn_hw as
select * from bndados
outer union corr
select * from hwdados;
quit;
And here is the output I get in the log:
21019 proc sql;
21020 title 'MED REC COMBINED';
21021 create table combined_bn_hw as
21022 select * from bndados
21023 outer union corr
21024 select * from hwdados;
ERROR: Column 115 from the first contributor of OUTER UNION is not the same type as its
counterpart from the second.
ERROR: Column 120 from the first contributor of OUTER UNION is not the same type as its
counterpart from the second.
ERROR: Column 173 from the first contributor of OUTER UNION is not the same type as its
counterpart from the second.
ERROR: Numeric expression requires a numeric format.
ERROR: Column 181 from the first contributor of OUTER UNION is not the same type as its
counterpart from the second.
ERROR: Column 185 from the first contributor of OUTER UNION is not the same type as its
counterpart from the second.
ERROR: Column 186 from the first contributor of OUTER UNION is not the same type as its
counterpart from the second.
21025 quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
感谢您的编辑,对不起! – chiccaboomberry
*尝试合并SAS *中的数据集时...此试用版在哪里?我们需要数据和代码来重现问题。 – Parfait
只需使用正常的数据步骤即可附加表格,您应该收到更多有用的错误消息。 '数据combined_bn_hw;设置bndados hwdados;运行;'它不会解决你的问题,但它会告诉你具有类型冲突的变量名称。 – Tom