2016-09-16 113 views
0

我在SAS中有以下代碼,我嘗試獲取abo_id和abo_bklantid的值不匹配的數據集。Where子句似乎不起作用

data set_2 
set final_set; 
where abo_id != abo_bklant_id; 
run; 

然而,這trows以下錯誤:

ERROR: Syntax error while parsing WHERE clause. 
ERROR: No input data sets available for WHERE statement. 
ERROR 56-185: SET is not allowed in the DATA statement when option DATASTMTCHK=COREKEYWORDS. Check for a missing semicolon in the 
      DATA statement, or use DATASTMTCHK=NONE. 

ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, 
      a missing value, INPUT, PUT. 

ERROR 76-322: Syntax error, statement will be ignored. 

任何想法我走到哪裏錯了?

回答

0

你缺少你的第一行分號:-)

data set_2; /* <<< here! */ 
set final_set; 
where abo_id ne abo_bklant_id; /* <<< cannot use != in SAS */ 
run; 

而且(信用羅伯特S)的!=操作是無效的SAS。

+3

在SAS中沒有'!='操作符。改用'^ ='或'ne'或'<>'運算符。 –

+0

好地方,回答更新! –

+3

不要使用<>來表示不等於。在大多數SAS中,MAX是運營商,而不是NE運營商。由於0大於-1,因此'-1'> 0'爲0。但是'-1^= 0'是1,因爲-1不等於0. – Tom