Thursday, March 20, 2008

Read missing values

/* By default - FLOWOVER; It will go next value and pick next value. This example shows missing the last two values - 3.4 and 3.5

(OUTPUT)
Obs A1 A2 A3 A4 A5
1 1.1 1.2 1.3 1.4 1.5
2 2.1 2.2 3.1 3.2 3.3
*/

DATA A_FLOWOVER;
INFILE CARDS FLOWOVER; /*DEFAULT*/
INPUT A1-A5;
CARDS;
1.1 1.2 1.3 1.4 1.5
2.1 2.2
3.1 3.2 3.3 3.4 3.5
;

PROC PRINT data=A_FLOWOVER;
title "Data=A_FLOWOVER";
RUN;

/* MISSOVER; it will skip the missing values in the line and grab next line

(OUTPUT)
Obs A1 A2 A3 A4 A5
1 1.1 1.2 1.3 1.4 1.5
2 2.1 2.2 . . .
3 3.1 3.2 3.3 3.4 3.5
*/

DATA B_MISSOVER;
INFILE CARDS MISSOVER;
INPUT A1-A5;
CARDS;
1.1 1.2 1.3 1.4 1.5
2.1 2.2
3.1 3.2 3.3 3.4 3.5
;

PROC PRINT data=B_MISSOVER;
title "Data=B_MISSOVER";
RUN;

/* STOPOVER; After you execute, the program will read the data till there is any missing data

(OUTPUT)
Obs A1 A2 A3 A4 A5
1 1.1 1.2 1.3 1.4 1.5
*/

DATA C2_STOPOVER;
INFILE CARDS STOPOVER;
INPUT A1-A5;
CARDS;
1.1 1.2 1.3 1.4 1.5
2.1 2.2
3.1 3.2 3.3 3.4 3.5
;

PROC PRINT data=C2_STOPOVER;
title "Data=C2_STOPOVER";
RUN;

No comments: