Reputation: 315
I'm build/have built a process for a team in the company I work for. However, I keep seeing this note whenever I run part of my code. SAS Seems to be converting my character values to numeric and it's bugging. It doesn't seem to be causing any apparent issues with my data...but I would like to know why, and solve this issue if I can. here's a snippet of the code from my log:
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
Upvotes: 0
Views: 346
Reputation: 9569
I suspect the issue is with this section of your code and the other similar sections:
IF Acct_Type = "1" or "01" then ...
IF inputAssocCode not =: "W" AND Error_Description not =: "A1/J1" OR "A2/J2";
Due to SAS operator precedence, this is equvalent to:
IF (Acct_Type = "1") or "01" then ...
IF inputAssocCode not =: "W" AND Error_Description (not =: "A1/J1") OR "A2/J2";
SAS will attempt to interpret the character literals "01" and "A2/J2" as logical values because they're being used next to an or
operator, which involves converting them to numeric first.
You should use the in
operator instead, e.g.
IF Acct_Type in ("1","01") then ...
IF inputAssocCode ne: "W" AND not (Error_Description in: ("A1/J1","A2/J2"));
Upvotes: 3