ERROR 79-322 Expecting a ) / ERROR 388-185: Expecting an arithmetic operator / ERROR 200-322: 该符号无法识别,将被忽略

ERROR 79-322 Expecting a ) / ERROR 388-185: Expecting an arithmetic operator / ERROR 200-322: The symbol is not recognized and will be ignored

我真的很沮丧。我只是使用与原始 NCI 宏代码相同的格式更改了某些合并症的代码定义。但是,我收到以下错误。你能帮我找出问题所在吗?我衷心感谢您的时间和帮助。 (下面附上日志和原代码供大家参考)

日志:

9643  data first_record_test;
9644      set merged_final;
9645
9646      array icd9 {*}  case_1_d0   case_1_d1   case_1_d2   case_1_d3   case_1_d4   case_1_d5
9646!  case_1_d6   case_1_d7   case_1_d8   case_1_d9
9647                      case_1_p1   case_1_p2   case_1_p3   case_1_p4   case_1_p5   case_1_p6
9647!  case_1_p7   case_1_p8   case_1_p9   case_1_p10
9648                      case_1_p11  case_1_p12  case_1_p13  case_1_p14  case_1_p15  case_1_p16
9648!  case_1_p17  case_1_p18  case_1_p19  case_1_p20
9649                      case_1_p21  case_1_p22  case_1_p23  case_1_p24  case_1_p25  case_1_p26
9649!  case_1_p27  case_1_p28  case_1_p29  case_1_p30;
9650
9651      do i=1 to dim(icd9);
9652
9653      *** ACUTE MYOCARDIAL INFARCTION;
9654      if icd9(i) in:('410') then acute_mi = 1;
9655
9656
9657      *** HISTORY OF MYOCARDIAL INFARCTION;
9658      else if icd9(i) in:('412') then history_mi = 1;
9659
9660
9661      *** CONGESTIVE HEART FAILURE;
9662      else if icd9(i)
9662! in:('39891','40201','40211','40291','40401','40403','40411','40413','40491','40493',
9663                          '4254','4255','4256','4257','4258','4259','428')then chf = 1;
9664
9665
9666      *** PERIPHERAL VASCULAR DISEASE;
9667      else if icd9(i) in:('0930','440','441','4471','5571','5579','V434') or
9668              ('4431'<=:icd9(i)<=:'4439') then pvd = 1;
9669
9670
9671      *** CEREBROVASCULAR DISEASE;
9672      else if icd9(i) in:('36234') or ('430'<=:icd9(i)<=:'438') then cvd = 1;
9673
9674
9675      *** COPD;
9676      else if icd9(i) in:('4168','4169','5064','5081','5088') or ('490'<=:icd9(i)<=:'505')
9676! then copd = 1;
9677
9678
9679      *** DEMENTIA;
9680      else if icd9(i) in:('290','2941','3312') then dementia = 1;
9681
9682
9683      *** PARALYSIS;
9684      else if icd9(i) in:('3341','342','343','3449') or ('3440'<=:icd9(i)<=:'3446') then
9684! paralysis = 1;
9685
9686
9687      *** DIABETES;
9688      else if icd9(i) in:('2508','2509') or ('2500'<=:icd9(i)<=:'2503') then diabetes = 1;
9689
9690
9691      *** DIABETES WITH COMPLICATIONS;
9692      else if icd9(i) in:('2504'<=:icd9(i)<=:'2507') then diabetes_comp = 1;
                                    --                 -
                                    79                 388
                                                       200
ERROR 79-322: Expecting a ).

ERROR 388-185: Expecting an arithmetic operator.

ERROR 200-322: The symbol is not recognized and will be ignored.

9693
9694
9695      *** MODERATE-SEVERE RENAL DISEASE;
9696      else if icd9(i)
          ----
          160
9696! in:('40301','40311','40391','40402','40403','40412','40413','40492','40493',
ERROR 160-185: No matching IF-THEN clause.

9697                         '582','585','586','5880','V420','V451','V56') or
9697! ('5830'<=:icd9(i)<=:'5837') then renal_disease = 1;
9698
9699
9700      *** MILD LIVER DISEASE;
9701      else if icd9(i)
9701! in:('07022','07023','07032','07033','07044','07054','0706','0709','570','571','5733','5734'
9701! ,'5738','5739','V427') then mild_liver_disease = 1;
9702
9703
9704      *** MODERATE-SEVERE LIVER DISEASE;
9705      else if icd9(i) in:
9706              ('4560'<=:icd9(i)<=:'4562') or
                         --                 -
                         79                 388
                                            200
                                            76
ERROR 79-322: Expecting a ).

ERROR 388-185: Expecting an arithmetic operator.

ERROR 200-322: The symbol is not recognized and will be ignored.

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

9707              ('5722'<=:icd9(i)<=:'5728') then liver_disease = 1;
9708
9709
9710      *** PEPTIC ULCER DISEAS;
9711      else if ('531'<=:icd9(i)<=:'534') then ulcers = 1;
9712
9713
9714      *** RHEUMATOLOGIC DISEASE;
9715      else if icd9(i) in:('4465','7100','7101','7102','7103','7104','7148','725') or
9715! ('7140'<=:icd9(i)<=:'7142') then rheum_disease = 1;
9716
9717      *'4465','7102','7103','7148';
9718
9719      *** AIDS;
9720      else if icd9(i) in:('042'<=:icd9(i)<=:'044') then aids = 1;
                                   --                -
                                   79                388
                                                     200
ERROR 79-322: Expecting a ).

ERROR 388-185: Expecting an arithmetic operator.

ERROR 200-322: The symbol is not recognized and will be ignored.

9721
9722
9723      end; *** End diagnosis code loop;

原代码:

data first_record_test;
    set merged_final;

    array icd9 {*}  case_1_d0   case_1_d1   case_1_d2   case_1_d3   case_1_d4   case_1_d5   case_1_d6   case_1_d7   case_1_d8   case_1_d9
                    case_1_p1   case_1_p2   case_1_p3   case_1_p4   case_1_p5   case_1_p6   case_1_p7   case_1_p8   case_1_p9   case_1_p10
                    case_1_p11  case_1_p12  case_1_p13  case_1_p14  case_1_p15  case_1_p16  case_1_p17  case_1_p18  case_1_p19  case_1_p20 
                    case_1_p21  case_1_p22  case_1_p23  case_1_p24  case_1_p25  case_1_p26  case_1_p27  case_1_p28  case_1_p29  case_1_p30;

    do i=1 to dim(icd9);

    *** ACUTE MYOCARDIAL INFARCTION;
    if icd9(i) in:('410') then acute_mi = 1; 
    

    *** HISTORY OF MYOCARDIAL INFARCTION;
    else if icd9(i) in:('412') then history_mi = 1; 
   

    *** CONGESTIVE HEART FAILURE;
    else if icd9(i) in:('39891','40201','40211','40291','40401','40403','40411','40413','40491','40493',
                        '4254','4255','4256','4257','4258','4259','428')then chf = 1; 


    *** PERIPHERAL VASCULAR DISEASE;
    else if icd9(i) in:('0930','440','441','4471','5571','5579','V434') or 
            ('4431'<=:icd9(i)<=:'4439') then pvd = 1; 


    *** CEREBROVASCULAR DISEASE;
    else if icd9(i) in:('36234') or ('430'<=:icd9(i)<=:'438') then cvd = 1; 
      

    *** COPD;
    else if icd9(i) in:('4168','4169','5064','5081','5088') or ('490'<=:icd9(i)<=:'505') then copd = 1; 
    

    *** DEMENTIA;
    else if icd9(i) in:('290','2941','3312') then dementia = 1; 
    

    *** PARALYSIS;
    else if icd9(i) in:('3341','342','343','3449') or ('3440'<=:icd9(i)<=:'3446') then paralysis = 1; 
      

    *** DIABETES;
    else if icd9(i) in:('2508','2509') or ('2500'<=:icd9(i)<=:'2503') then diabetes = 1; 
      

    *** DIABETES WITH COMPLICATIONS;
    else if icd9(i) in:('2504','2505','2506','2507') then diabetes_comp = 1; 
      

    *** MODERATE-SEVERE RENAL DISEASE;
    else if icd9(i) in:('40301','40311','40391','40402','40403','40412','40413','40492','40493',
                       '582','585','586','5880','V420','V451','V56') or ('5830'<=:icd9(i)<=:'5837') then renal_disease = 1; 
 

    *** MILD LIVER DISEASE;
    else if icd9(i) in:('07022','07023','07032','07033','07044','07054','0706','0709','570','571','5733','5734','5738','5739','V427') then mild_liver_disease = 1;      


    *** MODERATE-SEVERE LIVER DISEASE;
    else if icd9(i) in:
            ('4560'<=:icd9(i)<=:'4562') or
            ('5722'<=:icd9(i)<=:'5728') then liver_disease = 1; 
     

    *** PEPTIC ULCER DISEAS;
    else if ('531'<=:icd9(i)<=:'534') then ulcers = 1; 
     

    *** RHEUMATOLOGIC DISEASE;
    else if icd9(i) in:('4465','7100','7101','7102','7103','7104','7148','725') or ('7140'<=:icd9(i)<=:'7142') then rheum_disease = 1;  
   
    *'4465','7102','7103','7148';

    *** AIDS;
    else if icd9(i) in:('042'<=:icd9(i)<=:'044') then aids = 1; 
     

    end; *** End diagnosis code loop;


  *** Define arrays for comorbidity condition;
  array comorb (*) acute_mi--aids;
  *if last.&PATID then do;
    do i=1 to dim(comorb);
      if comorb(i)=. then comorb(i) = 0;
      end;

    *** Calculate the Charlson Comorbidity Score for prior conditions;
    Charlson = 
      1*(acute_mi or history_mi) +
      1*(chf) +
      1*(pvd) +
      1*(cvd) +
      1*(copd) +
      1*(dementia) +
      2*(paralysis) +
      1*(diabetes and not diabetes_comp) +
      2*(diabetes_comp) +
      2*(renal_disease) +
      1*(mild_liver_disease and not liver_disease) +
      3*(liver_disease) +
      1*(ulcers) +
      1*(rheum_disease) +
      6*(aids);

    *** Calculate the NCI Comorbidity Index for prior conditions;
    NCIindex = 
      1.14*(acute_mi) +
      1.08*(history_mi) +
      1.91*(chf) +
      1.30*(pvd) +
      1.32*(cvd) +
      1.69*(copd) +
      2.06*(dementia) +
      1.49*(paralysis) +
      1.34*(diabetes or diabetes_comp) +
      1.60*(renal_disease) +
      2.09*(mild_liver_disease or liver_disease) +
      1.08*(ulcers) +
      1.25*(rheum_disease) +
      1.79*(aids);

    output;


  keep  PATIENT_ID_NUMBER_N20 linenumber

        case_1_d0   case_1_d1   case_1_d2   case_1_d3   case_1_d4   case_1_d5   case_1_d6   case_1_d7   case_1_d8   case_1_d9
        case_1_p1   case_1_p2   case_1_p3   case_1_p4   case_1_p5   case_1_p6   case_1_p7   case_1_p8   case_1_p9   case_1_p10
        case_1_p11  case_1_p12  case_1_p13  case_1_p14  case_1_p15  case_1_p16  case_1_p17  case_1_p18  case_1_p19  case_1_p20 
        case_1_p21  case_1_p22  case_1_p23  case_1_p24  case_1_p25  case_1_p26  case_1_p27  case_1_p28  case_1_p29  case_1_p30

        acute_mi--aids Charlson NCIindex;

  label 
    Charlson           = 'Charlson comorbidity score'
    NCIindex           = 'NCI comorbidity index'
    acute_mi           = 'Acute Myocardial Infarction'
    history_mi         = 'History of Myocardial Infarction'
    chf                = 'Congestive Heart Failure'
    pvd                = 'Peripheral Vascular Disease'
    cvd                = 'Cerebrovascular Disease'
    copd               = 'Chronic Obstructive Pulmonary Disease'
    dementia           = 'Dementia'
    paralysis          = 'Hemiplegia or Paraplegia'
    diabetes           = 'Diabetes'
    diabetes_comp      = 'Diabetes with Complications'
    renal_disease      = 'Moderate-Severe Renal Disease'
    mild_liver_disease = 'Mild Liver Disease'
    liver_disease      = 'Moderate-Severe Liver Disease'
    ulcers             = 'Peptic Ulcer Disease'
    rheum_disease      = 'Rheumatologic Disease'
    aids               = 'AIDS'
    ;
run; 

但格式不同。

这是有效的语法。

if icd9(i) in:('0930','440','441','4471','5571','5579','V434')
 or ('4431'<=:icd9(i)<=:'4439') 
then pvd = 1;

If 有两个由 OR 运算符分隔的布尔表达式。第一个是测试任何值是否在可能值列表中,第二个是测试值是否落入值范围。

但是这个语法无效。

if icd9(i) in:('2504'<=:icd9(i)<=:'2507') then diabetes_comp = 1;

您正试图在要比较的值列表中使用布尔表达式。您要么需要使用真实的值列表:

if icd9(i) in:('2504' '2505' '2506' '2507') then diabetes_comp = 1;

或者使用其他模式。

if ('2504'<=:icd9(i)<=:'2507') then diabetes_comp = 1;