Special & Built-in Data Set in SAS
In the last topic, we learned the program structure of SAS programming and saw that Data is a primary component and building block of any data set. In this topic we will learn about parts of the SAS Data Set; at the same time, we will discuss some data set examples to find out the definition of the data set in SAS programming.
The Dataset is basically a combination of variables and their values, these values are also known as data values or observations. The dataset contains and organizes data values in the form of rows and columns within a table. In the SAS terminology, the rows are called observations, and the columns are called SAS variables.
We can also define SAS Dataset as a SAS file that stores in the SAS library. The SAS file is created and stored by SAS.
Here is the presentation of a dataset STPSAMP.STPSALE, how it looks in SAS:
Column (or variable)
Each column represents a variable in SAS table presentation. In the above image region, citysize, pop, product, and saletype are the columns or variables.
Observation (or rows)
Each row represents an observation in SAS dataset's table presentation. In the above image region: NC, NE, SO, WE, etc. citysize: S, M, and L pop: 25000, 37000, 48000, 32000, etc. product: A100 and saletype: R all are the observations.
Parts of the SAS Data Set
Data Set consists of Descriptor Portion, Data Portion, Special SAS Data Sets, and Built-in Data Sets. Let's see them in detail.
The descriptor portion of the dataset contains important information about the time and date of last modification, the number of observations and the number of variables in the dataset and many more. Consider the table below as an example of a descriptor part of the SAS Data Set, whose name is work.grad.
The data Portion consists of data values of the SAS dataset. These data values are arranged in the form of a table. The column contains variables, and the row contains observation values of these variables. Below is the depiction of it.
Let there is dataset is student
In the data portion example, There are four variables (Roll Number, Name, Class and Height) of the SAS data set and each has four numbers of observations values such as data values of Roll Number are 101, 102, 103 and 104, data values of Name are subhash, namrita, Preeti and sushma, data values of Class are 12, 10, 12 and 10, data values of Height are 155, 154, 156 and 153. The whole table is called a data set, and the combination of variables and observations is data values. SAS data is able to store any number of variables and observations.
Special Data Set
NULL Data Sets
Sometimes, it may happen that we want to execute any data step, but we do not want to create any datasets, in these cases, we can use _NULL_. The following statement creates a data step where no data sets are created.
Default Data Sets
SAS is able enough to remember the last dataset by using the reserved word _LAST_. If you execute a DATA or a PROC step without declaring the dataset, by default SAS uses the last executed dataset. It is called default data sets.
Automatic Naming Convention
If we do not give any name or reserve name_NULL_ to the SAS dataset, SAS automatically creates them with the names DATA1, DATA2, and so on. These automatically generated datasets are stored in the library. This feature is called Data Naming Convention.
4. SAS Built-in Data Set
There are some datasets in the SAS software that are already available in the SAS library and can be used to run, analyze and calculate sample programs. All the datasets are stored in my libraries under SASHELP.
Now, we want to use the data set named CARS, double click on this and a pane will open on the right side of the SAS window. The image below shows the CARS dataset, which has an inbuilt dataset in the SAS library.
So, this is all about the data set. We explained in an effortless way but if you still have any doubt feel free to ask in the contact section.