SAS数据步中如何添加满足= exam1 和 exam2的平均值 的final变量?

1个回答

  • DATA examgrade;

    INFILE DATALINES;

    INPUT studentid$ gender$ major$ exam1 exam2;

    final=mean(exam1,exam2);

    if final>=75 then grade='S';

    else grade='N';

    DATALINES;

    001 M BIO 80 84

    002 M EPI 75 73

    003 F EPI 90 86

    004 M BIO 83 85

    005 F EPI 94 94

    006 F EPI 88 84

    ;

    RUN;