Select Page

SAS DLM,DLMSTR,DELIMITER,DSD options and DATALINES4 Statement

SAS DLM,DLMSTR,DELIMITER,DSD options and DATALINES4 Statement

I have tried to explain SAS DLM,DLMSTR,DELIMITER options and SAS DATALINES4 Statement through simple examples.

/* default delimiter is blank. */
/* with the delimiter= or DLM= or DLMSTR= option in the INFILE statement. */

data set1;
length n1 $ 12;
input n1 $ s1 s2;
datalines;
R 11 4435
H 10 110
;
run;
data set1;
infile datalines delimiter=’,’;
length n1 $ 12;
input n1 $ s1 s2 s3;
datalines;
R, 11, , 4435
H, 10,13, 110
, 15,1134, ,
;
run;

/* */
/* If you want SAS to read consecutive delimiters as if there is a missing value */
/* between them, specify the DSD option in the INFILE statement. */

data set2;
infile datalines dsd delimiter=’,’;
length n1 $ 12;
input n1 $ s1 s2 s3;
datalines;
R, 11, , 4435
H, 10,13, 110
, 15,1134, ,
;
run;

/* when you have semicolon in your data then use datalines4, */
/* you must end the data lines with four consecutive semicolons */

data set3;
infile datalines4 dsd delimiter=’,’;
length n1 $ 12;
input n1 $ s1 s2 s3;
datalines4;
R, 11, , 4435
H, 10;13, 110
, 15,1134, ,
;;;;
run;

About The Author

I like to write. So i write everything. No specific rules but here to enjoy the ride.

Like us or Dislike us. Please Let us know Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Comments