SAS Datalines

Introduction to SAS Datalines

The following article provides an outline for SAS Datalines. The SAS data line is one of the statements that can be used as the input format that the user will provide the input to read the datas directly on the codes rather than the external file. The last statement provides the data step that immediately precedes the first line of data by using the null statement that denotes the single semicolon for indicating the input data.

Overview of SAS Datalines

SAS handles the data line characters with the data step, and it can immediately precede the first line of input as the data line by using a null statement along with a semicolon. It indicates the input data for separate data steps by entering the multiple data sets with SAS processes the data lines that exactly match the 80-byte characters punched the card images with padded blanks and not using the NOCARDIMAGE on SAS data processes lines which no longer than the byte columns in the entire data sets. INFILE data statement, which helps to point out the raw data lines stored in another file on the %INCLUDE statement, brings SAS program statements. SET, MERGE, MODIFY and UPDATE statements help to observe the SAS data sets.

How to Use SAS Datalines?

The SAS datalines statement on the last statement in the data step helps precede the first data line by using the null statement as a single semicolon to indicate the input data end. We can use only one datalines statement in the data step to entire multiple data sets and assign the values for two sets of character variables name and dept for the data step on each observation. The missover has another option to assign the values on each type of variable that does not contain the values. It can also use the other types like datalines4, which is on the same line that includes the internal data semicolons until it encounters the four semicolons, which helps to execute the rest of the program. No significant data differences exist between the two cards defined as the alias. It should have identical data behavior restrictions like the statements are not called to the CAS servers, which are on the declarative data type, including the file-handling category.

It includes the environment variable’s other configuration, file, SAS command, Options statement, and SASV9_OPTIONS. Input control and data processing system are used to enter the data line inputs on the shipped no-card image default. The option is restricted by using the site administrator. Mainly SAS source and data lines which processed and specify the datas to the punched card images along with 80 character data bytes, and the column is mapped to the tokens as the series of characters that handles the SAS treats as the discrete word on string quotation marks that begin on literal tokens and data lines are not truncated to their character lengths. It accepts SAS source and target data lines not created and treated as the 80-byte characters NOCARDIMAGE. With the help of the datalines statement, the SAS will quickly create the new dataset from scratch; input is both name and type of each variable in the dataset. Actual values are referred to in the dataset dollar sign($) will follow the variable name, which tells that SAS is on the character variable.

Steps to Create and Use the Datalines

Given below are the steps to create and use the datalines:

1. Navigate to the below URL and login it.

Navigate the URL and login


3. Example syntax and code to create the datalines.

4. data Employees;

5. input id $ name $;

6. datalines;

7. 1 Siva

8. 2 Raman

9. 3 Sivaraman

SAS Datalines 2

10. We can use the datalines in the simple example code.

SAS Datalines Statement

The datalines statement is used whenever the data does not contain the semicolons; if the data include semicolons, then the datalines4 statement is used for reading the data or pointing out the data location. INFILE statement points are mainly used for raw data lines stored in another file which helps to read those data lines.

We can use %INCLUDE as one of the main statements, which helps bring the SAS program statements, read the data lines stored in the SAS files, or call external files in the current programs. Likewise, the SET, MERGE, MODIFY and UPDATE statements help to read the data observations from the existing data sets.



data Employees;
  input name $ designation $;
Siva MD
Raman Manager


passing the user input datas in the SAS

1. The above example is the primary example for passing the user input datas in the SAS.

name and designation

2. Here, the employees are the user datas that are declared as the data and created the two variables like name and designation.

3. Each variable type is assigned a $ symbol to store and retrieve the data values.

4. Next, we create datalines as the keyword.

create datalines

5. The employee’s name and designation in the SAS program code.

SAS Datalines Date Set

The SAS datalines date set is used and performed as the other language’s dates along with specific numeric values and assigned to each day as the input. All SAS dates begin from January 1st, and years like 1960, taking the inputs as zero-day. And then, all previous and subsequent dates are therefore represented by keeping the date in a numeric set of values from the starting point.



DATA Employeedetails;
input id name$ dept$ doj$;
1 Siva Accounts 11/06/2020
2 Raman Commerce 12/06/2020
3 Sivaraman IT 13/06/2020
4 Arun Support 14/06/2020
5 Kumar Software 15/06/2020
PROC PRINT DATA=Employeedetails;


SAS Datalines 6

1. The second example will use the exact keywords, data declarations, variables, etc.

2. But additionally, we used the date function in the SAS.

we used date function

3. This dating type is declared in any variable with a $ sign.


The datalines are the type of keywords in SAS; it has many keywords along with the most pre-dominant and required ones for the SAS. In addition, it has INFILE and read-in statements to perform the datalines with the delimiter options for using the data list inputs to read the values.

Recommended Articles

This is a guide to SAS Datalines. Here we discuss the introduction, use, and steps to create and use the datalines and statements. You may also have a look at the following articles to learn more –

  1. SAS Visual Analytics
  2. Data Architects
  3. SASS if()
  4. SAS Join

The post SAS Datalines appeared first on EDUCBA.

Source link

Leave a Reply

Your email address will not be published.