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

by | Oct 26, 2018 | SAS | 0 comments

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;

Join Today

Know more about latest trends, News in Field of Data Analytics.

We will offer Free SAS and Python Programme in Data Science & enhance your understanding of data analysis.

By rlochan2021

We offer Everything Free here and always will be, so joining is Risk Free and Always Cost Free.

Check Out These Related Posts

Proc Contents Syntax, points to remember

Basic Syntax is:- PROC CONTENTS DATA=abc; RUN; proc contents data=libref.filename <options> options:- CENTILES Print centiles information for indexed variables DATA= Specify the input data set DETAILS|NODETAILS Include information in the output about the number...

read more

Topics on SAS Arrays

1.what is the syntax of SAS Array? array array-name {n} <$> array-elements <(initial-values)>; The ARRAY statement is a compiler statement within the data step. In addition, the array elements cannot be used in compiler statements such as DROP or KEEP. I Array Q...

read more

SAS Proc Report Tutorials:- Sample Code

First immerse yourself in learning the Basic options of Proc Report because there are too many and you may get overwhelmed. A Sample Code for you:- proc sql; create table newbaseball as SELECT ‘Name’n as Team, nAtBat , nHits , nHome , nRuns , nRBI , nBB , YrMajor , CrAtBat , CrHits , CrHome […]

read more

0 Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *