The CARD or the DATALINES statement is valid in the data step and is used to Read the real data values into the program. Generally while running the sas programs, we use an input file(a physical DASD file) and give a reference to the Data step using INFILE keyword.
DATALINE is nothing but Reading the Data inline. We can also use the keyword CARD. Both are equivalent in terms of function. CARDS were used long back when punch cards were used in mainframe system.
Have a look into the sas program below.
//SAS EXEC SAS
//WORK DD SPACE=(CYL,(50,10),RLSE)
//SYSIN DD *
OPTION NOCENTER;
OPTION SORTLIB='';
DATA COV;
INPUT @23 ACCTTYPE $CHAR01.
@10 NMBER $CHAR02.
@24 ACCTNO $CHAR10.
;
DATALINES;
111111111111111111112222222222233333333
111111111111111111112222222222233333333
111111111111111111112222222222233333333
111111111111111111112222222222233333333
;
PROC PRINT DATA=COV;
A very small program, but there is no input file in the JCL. We are reading the input data using the DATALINES keyword. IF we print the data we will get the same expected output.

No comments:
Post a Comment