The powerful data analytics system SAS isn’t just for Windows or UNIX environments—it’s fully capable of running in a mainframe environment like z/OS. In the world of mainframe computing, SAS opens up versatile opportunities for data processing, integration with large‐scale databases (like DB2 or Oracle Database), and high‐volume reporting.
Core Components of a SAS Program
When you write a SAS program in the mainframe environment, there are two primary steps you will always deal with:
- The DATA step – where you read and structure your input data
- The PROC step (procedure step) – where you run analytic routines or generate reports
DATA Step
In the DATA step, SAS ingests data from an input source—this could be a flat file, a dataset referenced via JCL DD statements, or “instream” data. You define the layout of the input (similar to a COBOL copybook in mainframe jargon) and then allow SAS to convert that data into an internal SAS data set for processing.
PROC Step
Once the data set is available, the PROC step invokes built‐in SAS procedures: routines that analyze, manipulate, or present the data (for example, sorting, summarizing, printing). These routines save you from writing low-level code for many common tasks because they’re already pre-written and optimized.
Pictorially the flow will be like

let’s see the code below to understand how it works.

The above JCL shows EXEC SAS keyword which is how you call SAS procedure in Z/OS environment. Like every JCL it has the input file in DD name INDD and output file with DD name OUTDD. The entire SAS program(in this example) is written inside the SYSIN Statement.
It starts with OPTIONS keyword which is optional. Will check the OPTION parameters in other posts. Let us focus on the statement DATA TEST. It marks the start of DATA step. The input file name is specified with INFILE Keyword. INFILE links the input dataset INDD in this case.DATA TEST: This is user defined name to the SAS dataset. DATA is the SAS keyword and TEST is user defined name.INPUT keyword : This is used to define the layout of the input dataset.
‘ @’ starting byte of the variable followed by the name of the variable followed by the datatype and the length. As per the code snippet, we are declaring two inputs DELIVERY_NR and WT
With these two statements SAS creates an internal dataset. Any other data stored beyond 16 bytes will be ignore by SAS. SAS stores the data in temporary memory buffer. This is covered in other post in details where we know about PDV(program data vector) and Input buffer.
PROC PRINT: After we format the data in DATA step, we can use the PROC PRINT statement, to print the data in SAS dataset TEST. So it will display the delivery_nr and the weight.
The Output will look like:

The first statement is the system default displayed as ” The SAS System”.
The PROC PRINT will print the data to SASLIST which is visible in the spool.
‘OBS‘ column tells us the number of observations as read from input. Under ‘Delivery_NR‘ we can see the delivery numbers from input and under ‘WT‘ the weights are displayed, as read from input. Thus we can see the input data is now formatted into proper output format.
This is typically where SAS comes so handy. You need not define or think about the rest of the data in the input. Extract that part that is needed and relevant for you.
Key SAS Terminology for Mainframe Practitioners
SAS LOG: A system output log that shows all executed steps, messages, and diagnostics inside a SAS run.
Dataset: A SAS data set is the collection of data created or referenced by a DATA step.
Observation (OBS): An individual record/row within a SAS dataset.
Variables/Values: The columns and corresponding values inside the dataset.
Summary
In essence:
- The DATA step reads and structures your data.
- The PROC step uses SAS’s built‐in routines to handle analytics, reporting, and data manipulation.
- In a mainframe context, SAS runs inside a JCL job, reads datasets via DD statements, and produces output to the JES spool or other datasets.
- Knowing terms such as dataset, observation, SAS LOG, and layout definition helps you interpret SAS programs more effectively.
If you’re just getting started with SAS on z/OS, mastering the DATA and PROC steps is a great first milestone. From there you’ll explore sorting, summarizing, merging, and generating meaningful business reports from your mainframe data.
Next Steps
Stay tuned for our next article, where we’ll dive into how to use the PROC SORT step in a mainframe SAS environment—and how you can chain multiple PROC steps in your JCL workflow for more advanced processing.
Leave a comment