Chapter Contents

Previous

Next

Components of the SAS Language


SAS Files

When you work with SAS, you use files that are created and maintained by SAS, as well as files that are created and maintained by your operating environment, and that are not related to SAS. Files with formats or structures known to SAS are referred to as SAS files. All SAS files reside in a SAS data library.

The most commonly used SAS file is a SAS data set. A SAS data set is structured in a format that SAS can process. Another common type of SAS file is a SAS catalog. Many different kinds of information that are used in a SAS job are stored in SAS catalogs, such as instructions for reading and printing data values, or function key settings that you use in the SAS windowing environment. A SAS stored program is a type of SAS file that contains compiled code that you create and save for repeated use.

Operating Environment Information:   In some operating environments, a SAS data library is a physical relationship among files; in others, it is a logical relationship. Refer to the SAS documentation for your operating environment for details about the characteristics of SAS data libraries in your operating environment.  [cautionend]


SAS Data Sets

There are two kinds of SAS data sets:

A SAS data file both describes and physically stores your data values. A SAS data view, on the other hand, does not actually store values. Instead, it is a query that creates a logical SAS data set that you can use as if it were a single SAS data set. It enables you to look at data stored in one or more SAS data sets or in other vendors' software files. SAS data views enable you to create logical SAS data sets without using the storage space required by SAS data files.

A SAS data set consists of the following:

The descriptor information describes the contents of the SAS data set to SAS. The data values are data that has been collected or calculated. They are organized into rows, called observations, and columns, called variables. An observation is a collection of data values that usually relate to a single object. A variable is the set of data values that describe a given characteristic. The following figure represents a SAS data set:

[IMAGE]

Usually, an observation is the data that is associated with an entity such as an inventory item, a regional sales office, a client, or a patient in a medical clinic. Variables are characteristics of these entities, such as sale price, number in stock, and originating vendor. When data values are incomplete, SAS uses a missing value to represent a missing variable within an observation.


External Files

Data files that you use to read and write data, but which are in a structure unknown to SAS, are called external files. External files can be used for storing

Operating Environment Information:   Refer to the SAS documentation for your operating environment for details about the characteristics of external files in your operating environment.  [cautionend]


Database Management System Files

SAS software is able to read and write data to and from other vendors' software, such as many common database management system (DBMS) files. In addition to base SAS software, you must license the SAS/ACCESS software for your DBMS and operating environment.


SAS Language Elements

The SAS language consists of statements, expressions, options, formats, and functions similar to those of many other programming languages. In SAS, you use these elements within one of two groups of SAS statements:

A DATA step consists of a group of statements in the SAS language that reads raw data or existing SAS data sets to create a SAS data set. Once your data is accessible as a SAS data set, you can analyze the data and write reports by using a set of tools known as SAS procedures.

A group of procedure statements is called a PROC step. SAS procedures analyze data in SAS data sets to produce statistics, tables, reports, charts, and plots, to create SQL queries, and to perform other analyses and operations on your data. They also provide ways to manage and print SAS files.

You can also use global SAS statements and options outside of a DATA step or PROC step.


SAS Macro Facility

Base SAS software includes the SAS Macro Facility, a powerful programming tool for extending and customizing your SAS programs, and for reducing the amount of code that you must enter to do common tasks. Macros are SAS files that contain compiled macro program statements and stored text. You can use macros to automatically generate SAS statements and commands, write messages to the SAS log, accept input, or create and change the values of macro variables. For complete documentation, see SAS Macro Language: Reference.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.