我为我所在公司的团队建立/建立了一个流程。但是,每当我运行部分代码时,我都会看到这个注释。 SAS似乎是将我的角色值转换为数字并且它的错误。它似乎没有引起我的数据明显的问题...但我想知道为什么,如果可以的话,解决这个问题。这是我日志中的代码片段:
MPRINT(CFPB): DATA trunc;
MPRINT(CFPB): SET eq_final;
MPRINT(CFPB): Acct_Num=SUBSTR(Acct_Numb,7,4);
MPRINT(CFPB): Source = "Eq";
MPRINT(CFPB): IF Acct_Type = "1" or "01" THEN Acct_Description = "Unsecured";
MPRINT(CFPB): IF Acct_Type = "0" or "00" THEN Acct_Description = "AutoOnly";
MPRINT(CFPB): IF Acct_Type = "2" or "02" THEN Acct_Description = "AutoOther";
MPRINT(CFPB): IF Acct_Type = "6D" THEN Acct_Description = "HELON";
MPRINT(CFPB): IF Acct_Type = "89" THEN Acct_Description = "HELOC";
MPRINT(CFPB): IF Acct_Type = "0G" THEN Acct_Description = "FlexSpending";
MPRINT(CFPB): IF Acct_Type = "18" THEN Acct_Description = "CrCard";
MPRINT(CFPB): IF inputAssocCode not =: "W" AND Error_Description not =: "A1/J1" OR "A2/J2";
MPRINT(CFPB): IF Error_Description not =: "No Error";
MPRINT(CFPB): DROP Acct_Numb ;
MPRINT(CFPB): RUN;
NOTE: Character values have been converted to numeric values at the places given by:
(Line):(Column).
33:113 33:185 34:2 36:118
NOTE: Invalid numeric data, 'A2/J2' , at line 36 column 118.
BASE_CIS_ID=00000123456
Error_Description=A2/J2 Last Name is Missing or Invalid ACCT_Type=6D inputAssocCode=W
Acct_Num=1234 Source=Equifax Acct_Description=HELON _ERROR_=1 _N_=2
NOTE: Invalid numeric data, 'A2/J2' , at line 36 column 118.
BASE_CIS_ID=00000234567 Error_Description=A2/J2 First Name is Missing Invalid
ACCT_Type=00 inputAssocCode=W Acct_Num=2345 Source=Equifax Acct_Description=AutoOther _ERROR_=1
_N_=3
答案 0 :(得分:3)
我怀疑问题出在您的代码的这一部分和其他类似的部分:
IF Acct_Type = "1" or "01" then ...
IF inputAssocCode not =: "W" AND Error_Description not =: "A1/J1" OR "A2/J2";
由于SAS运算符优先级,这等同于:
IF (Acct_Type = "1") or "01" then ...
IF inputAssocCode not =: "W" AND Error_Description (not =: "A1/J1") OR "A2/J2";
SAS将尝试将字符文字“01”和“A2 / J2”解释为逻辑值,因为它们被用在or
运算符旁边,这涉及首先将它们转换为数字。
您应该使用in
运算符,例如
IF Acct_Type in ("1","01") then ...
IF inputAssocCode ne: "W" AND not (Error_Description in: ("A1/J1","A2/J2"));