SAS中文论坛

标题: 银行客户分析中的细节问题 [打印本页]

作者: shiyiming    时间: 2005-12-4 18:43
标题: 银行客户分析中的细节问题
请各位大侠看看这段程序有没有问题呀,谢谢关注,我在线期待!
需求:把客户身份证中的出生年月和开户时候填的出生年月不一致的客户踢去。
data work.cannotpass;
set work.test1123;
if length(compbl(ID))=15  then IDbirth = '19'||substr(compbl(ID),6,<6>);
else if  length(compbl(ID))=18 then  IDbirth = substr(compbl(ID),6,<8>);
if IDbirth ^= 'birthtime';
run;
其中ID,birthtime都是$型,程序运行后error:
1194  data work.cannotpass;
1195  set work.test1123;
NOTE: SCL source line.
1196  if length(compbl(ID))=15  then IDbirth = '19'||substr(compbl(ID),6,<6>);
                                                                         -
                                                                         22
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.

1196! if length(compbl(ID))=15  then IDbirth = '19'||substr(compbl(ID),6,<6>);
                                                                            -
                                                                            22
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string,
              a numeric constant, a datetime constant, a missing value, bitstring, INPUT, PUT.

NOTE: SCL source line.
1197  else if  length(compbl(ID))=18 then  IDbirth = substr(compbl(ID),6,<8>);
                                                                         -
                                                                         22
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.

1197! else if  length(compbl(ID))=18 then  IDbirth = substr(compbl(ID),6,<8>);
                                                                            -
                                                                            22
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string,
              a numeric constant, a datetime constant, a missing value, bitstring, INPUT, PUT.

1198  if IDbirth ^= 'birthtime';
1199  run;

NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
      0:-1                                     <no line/column information available>
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.CANNOTPASS may be incomplete.  When this step was stopped there were 0
         observations and 37 variables.
WARNING: Data set WORK.CANNOTPASS was not replaced because this step was stopped.
NOTE: DATA statement used:
      real time           0.03 seconds
      cpu time            0.03 seconds


1200  proc sort data=work.cannotpas;
1201  by birthtime ;

NOTE: Input data set is empty.
NOTE: The data set WORK.CANNOTPASS has 0 observations and 37 variables.
NOTE: PROCEDURE SORT used:
      real time           0.00 seconds
      cpu time            0.00 seconds
作者: shiyiming    时间: 2006-3-4 14:40
标题: 银行客户分析中的细节问题
data countpass;
set testcount;
if length(compbl(id))=15 then IDbirth = '19'||substr(compbl(ID),7,6);
else if length(compbl(ID))=18 then IDbirth = substr(compbl(ID),7,8);
if IDbirth=birthday then output;
run;

Perhaps, syntax error happen on calling substr. try again.




欢迎光临 SAS中文论坛 (http://mysas.net/forum/) Powered by Discuz! X3.2