Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

SAS dataset


May 26, 2021 SAS


Table of contents


The data that the SAS program can use for analysis is called an SAS dataset. I t was created using the DATA step. S AS can read various files as its data sources, such as CSV, Excel, Access, SPSS, and raw data. I t also has many built-in data sources available. I f the SAS program uses a dataset, the dataset is called a temporary dataset and is then discarded after the session runs. B ut if it is stored permanently for future use, it is called a permanent dataset. A ll permanent datasets are stored under a specific library. S AS datasets are stored as rows and columns, also known as SAS data tables. B elow we see an example of a built-in permanent dataset, as well as the red color of an external source.

SAS built-in dataset

These datasets are already available in installed SAS software. T hey can be explored and used to form sample expressions for data analysis. T o explore these datasets, go to Library - My Library - SASHELP. A s we expand, we can see a list of names for all built-in datasets.

SAS dataset

Let's scroll down to find a dataset named CARS. D ouble-clicking on this dataset will open it in the right pane, and we can explore it further. W e can also minimize the left pane by using the maximize view button under the right pane.

SAS dataset

We can scroll to the right using the scroll bar at the bottom to explore all the columns in the table and their values.

SAS dataset

Import an external dataset

We can export our own files as datasets using the import features available in SAS Studio. H owever, these files must be available in the SAS server folder. T herefore, we must use the upload options under the server files and folders to upload the source data files to the SAS folder.

SAS dataset

Next, let's use the above file in the SAS program by importing it. T o do this, we use the option Tasks - Utilities - Import data, as shown below. D ouble-click the Import Data button, open the window on the right, and select the file for the dataset.

Next, click the Select File button under Import Data Program in the right pane. T he following is a list of file types that can be imported.

SAS dataset

We select the "employee" file stored in .txt system and get the imported file, as shown below.

SAS dataset

View the imported data

We can view the imported data by running the default import code generated using the Run option

SAS dataset

We can import any other file type in the same way as above and use it in various SAS programs.