當試圖合併的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