SAS Data Set – 5 Mins Guide for Special & Built-in Data Set
In this SAS Tutorial, we will discuss the SAS Data Set. Data is the building block and primary constituent of any data set. We will also learn about parts of the SAS Data Set: Descriptor Portion and Data Portion, Special SAS Data Sets and Built-in Data Sets. Simultaneously, we will discuss some Data Set examples to explore the definition of Data Set in SAS Programming.
What is SAS Data Set?
A SAS dataset is basically a SAS file that store in the SAS library, that create and a process by SAS. A dataset contains data values that organize in the form of rows and columns inside a table. In SAS terminology, rows are called observations and columns are called SAS variables.
Here’s what a dataset in SAS looks like
Variables (also called columns)
Observations (also called rows)
Each line represents one observation, while ids, bday, Gender, Rank, and State are variables. The data point 10NOV1994 is one of the values of the variable bday and is also part of the sixth observation.
Parts of SAS Data Set
There are two types of SAS Data Set: Descriptor Portion and Data Portion.
1. Descriptor Portion
The descriptor portion of a SAS data set contains vital information of the data set, such as the name of the data set, the date and time at which the data set was created. The time and date it was last modified on, the number of observations in the dataset and the number of variables. The following table is an illustration of the descriptor portion of a SAS data Set with the name work.grade.
Learn about different components of the SAS User Interface
2. Data Portion
The data portion basically consists of all data values of the SAS dataset. The data values are organized in the form of a table. Below is an illustration of the same.
In this SAS Data Set example, the number 57 is a data value, the name Linda is a data value, weight 105 is a data value and so on. The variables (columns) contain data values that describe a particular characteristic of the thing being measure such as weight in the above table. SAS data has the ability to store thousands of variables.
The SAS data set has four variables — the id, name, height, and weight. The observations (or rows) are collections of data values that refer to one particular object (such as a person named Linda). The values 55, Linda, 60″, and 105 constitute a single observation in the above data set. SAS data has the ability to store any number of observations just like variables. SAS data set above contains five observations.
Explore the features of SAS programming language
Special SAS Data Set
There are three types of special SAS Data Set:
1. NULL Data Sets
Sometimes, it might happen that we wish to execute a DATA step, but we do not want to create a dataset, in such cases _NULL_ can use. The following statement begins a DATA step where no data set creates:
2. Default Data Sets
SAS is clear enough to remember the last dataset that uses by using the reserve word _LAST_. If we execute a DATA or a PROC step without mentioning the dataset, SAS by default makes use of the _LAST_ dataset.
3. Automatic Naming Convention
If you do not give a name to the SAS dataset or the reserved name _NULL_ in the DATA statement, SAS automatically creates data sets with the names DATA1, DATA2, and so on that get store in the library. This feature is called as the DATA naming convention. Here is an example of a statement that SAS dataset produces using the data naming convention:
Have you checked? – Advantages and Disadvantages of SAS Programming
SAS Built-in Data Set
SAS software has some datasets that are already available in the SAS library and can use for running sample programs, doing analysis and calculations. All datasets store under SASHELP in my libraries.
Now let us say we want to use the data set named CARS, double-click on it and a pane will open on the right. The image below shows the CARS dataset that is an inbuilt dataset in the SAS library.
The entire columns and data values can see while scrolling through the data set.
We studied that SAS Data Sets are an integral part while developing any program in SAS. The most important feature is that it allows multiple variables and thousands of observations to organize inside a table. SAS also has the feature of using a default, and null data sets when no dataset is specified.
Any queries regarding article? Enter in the comments section. We will be glad to hear from you.
Prepare for your SAS interview by practicing SAS interview questions