DATA MYCLASS;
SET SASHELP.CLASS;
IF WEIGHT<120 THEN NOTE= 'Normal';
ELSE DO;
NOTE= 'Heavy';
/* 赋值成缺失值 */
WEIGHT=.;
END;
RUN;
PROC PRINT; RUN;
DATA B;
DO k = 11 TO 0 BY -3;
IF k < 5 THEN i = k;
ELSE i = k - 1;
OUTPUT;
END;
RUN;
PROC PRINT; RUN;
DO WHILE:只要条件满足,DO-END 之间语句被重复执行。
DATA D;
j = 0;
DO WHILE (j <= 4);
OUTPUT;
j = j + 1;
END;
RUN;
PROC PRINT; RUN;
DO UNTIL:DO-END之间语句被重复执行,直到条件满足停止。
DATA D;
j = 0;
DO UNTIL (j > 4);
OUTPUT;
j = j + 1;
END;
RUN;
PROC PRINT; RUN;
DO OVER:
DATA test;
ARRAY X X1-X5 (1 2 3 4 5);
DO OVER X;
X=X*100;
OUTPUT;
END;
RUN;
PROC PRINT; RUN;