LEARN.COBOLSTACK.COM
//CS180  EXEC PGM=COURSE,PARM='CS180'

Developer track · Intro → Core · self-paced ~24h (5–6 weeks at 5h/week) · prerequisite: CS100

SAS for z/OS: From Zero to Batch Reports

SAS from zero to real batch reports on z/OS — no SAS and no other language needed. In plain English and in short sessions: the DATA step and the PROC step, reading the SAS log and its NOTE, WARNING and ERROR lines, INPUT with DATALINES and INFILE — list, column and formatted input — informats, formats and SAS dates, the program data vector and the implied loop, missing values, IF, WHERE and DO, data sets kept in a library on a DD statement, SET, MERGE and BY with FIRST. and LAST., RETAIN and the sum statement, arrays, functions, PROC PRINT, MEANS, FREQ and SUMMARY, PROC SQL, and the macro basics. Thirteen sessions, thirteen programs, each one checked from your own job: by the last one your own report program, kept in your own library and run by a one-step job, reads a sales data set, writes branch totals to a report and checks a control total.

Self-paced available Cohort

Open for enrollment now. No SAS and no other programming language assumed — only CS100 Mainframe Foundations: you can log on, edit a member, submit a job and find its output. The lesson videos for this course are not recorded yet: every session below is published as its lessons and lab now and marked Coming soon until its videos are released. Where next: CS120 JCL & Batch for the JCL every SAS job runs in, and CS140 DB2 & SQL on z/OS to take the SQL of Session 12 to the database itself.

Plans: Free individual at no cost, or Paid individual at $249 per course, one-time — code review, extra exercises, grading and priority support.

//SYLLABUS DD DISP=SHR

Syllabus

Every session ends in a lab on your own environment. Labs are machine-checked against expected outputs — you and your L&D team always know exactly where you stand.

What SAS is, and your first run

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Four videos. What SAS is — a language and a set of ready-made procedures for data: read it, change it, summarize it and report on it — and where it runs on the mainframe: batch jobs that turn files, performance data and extracts into reports in banks, insurers and governments. A program is made of DATA steps, which build data, and PROC steps, which use it. Then your first run, before any theory: a one-step job, EXEC SAS, with your program in-stream on SYSIN, and a DATA step whose only work is to PUT one line. You copy the job as it is; Session 2 takes it apart. Live on the system: the step return code, your line in the SAS log, the NOTE that names the data set the step built, and what the log says when a statement name is mistyped.

LAB Allocate your JCL library, type the job into it, submit it, and find the return code and your line in the SAS log. Then change the text so that it contains your userid and run it again: RC 0. Session 1 checkpoint (SA01), checked from your own job.

4 videos · ~21 min
  1. 1.1 What SAS Is 5 min
  2. 1.2 Where SAS Runs on the Mainframe 5 min
  3. 1.3 Your First Run: EXEC SAS 6 min
  4. 1.4 Lab: Make It Yours 5 min

Steps, statements and the SAS log

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Five videos. Every statement ends with a semicolon; a DATA statement starts a DATA step, a PROC statement a procedure, and RUN ends a step. Global statements — TITLE and OPTIONS — stay in force until you change them. The SAS log is the first thing to read after every run: your program’s lines, numbered, a NOTE for each step, and an ERROR line where a statement could not be used — with the step return code that goes with it: 0 clean, 8 an error. The job line by line: EXEC SAS runs the cataloged procedure, SYSIN holds the program, the log goes to SASLOG and printed results to SASLIST. Free format: case, spacing, comments, and names.

LAB Program ORDER: a TITLE that contains your userid, a DATA step that builds one observation — ITEM, PRICE, QTY and COST = PRICE * QTY — and PROC PRINT. RC 0; the title and COST 7.5 in the listing. Session 2 checkpoint (SA02).

5 videos · ~27 min
  1. 2.1 Statements and Steps: DATA, PROC and RUN 5 min
  2. 2.2 Reading the SAS Log: NOTE, WARNING and ERROR 6 min
  3. 2.3 The Job, Line by Line 6 min
  4. 2.4 Free Format: Case, Layout, Comments and Names 5 min
  5. 2.5 Lab: Two Steps and a Title 5 min

The DATA step: DATALINES and list input

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Four videos. A SAS data set is a table: observations are its rows, variables its columns, and every variable is numeric or character. INPUT with list input reads values separated by blanks, and DATALINES puts the data in the program itself. A $ after a name makes it character. PROC CONTENTS shows what a data set holds, PROC PRINT what is in it — and a forgotten $ turns a name into missing values.

LAB Program SALES: a DATA step that reads six sales — BRANCH (character) and AMOUNT — with list input from DATALINES, and PROC PRINT. The log says six observations and two variables; the listing shows them. Session 3 checkpoint (SA03).

4 videos · ~22 min
  1. 3.1 A Data Set Is a Table 5 min
  2. 3.2 INPUT and DATALINES: List Input 6 min
  3. 3.3 Character Variables and the $ 5 min
  4. 3.4 Lab: Your First Data Set 6 min

Column and formatted input, informats and formats

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Five videos. Column input reads each value from its own columns, so a value can contain blanks. Formatted input moves the pointer with @ and reads with an informat: $w. for text and w.d for numbers, where d places implied decimals. A format decides how a value is written — w.d, COMMA, DOLLAR, Z — and a FORMAT statement in the DATA step keeps it with the variable. A SAS date is a number: the days since 1 January 1960. Read date text and convert it with the INPUT function and YYMMDD10., then show it with DATE9.

LAB Program LAYOUT reads three fixed records — branch in 1–5, a date in 7–16 and an amount with two implied decimals in 18–25 — converts the date, and prints NORTH $12.50 02NOV2026, SOUTH $120.00 04NOV2026 and WEST $200.00 05NOV2026. RC 0. Session 4 checkpoint (SA04).

5 videos · ~28 min
  1. 4.1 Column Input 5 min
  2. 4.2 Formatted Input: @, $w. and w.d 6 min
  3. 4.3 Formats: How a Value Is Written 6 min
  4. 4.4 SAS Dates: A Number of Days 6 min
  5. 4.5 Lab: Read a Fixed Layout 5 min

The PDV and the implied loop

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Four videos. A DATA step runs in two phases: compile — every statement is checked and the program data vector, the PDV, is laid out — and execute, a loop that runs once per record: the variables are set to missing, INPUT fills them, your statements run and the observation is written. _N_ counts the passes. A missing value is a period; arithmetic with it gives missing, the SUM function skips it, and the log says when missing values were generated.

LAB Program TAXES reads three sales, one of them missing, computes a rounded 7.5% tax and a total with SUM, and PUTs OBS 1 NORTH 13.44, OBS 2 SOUTH . and OBS 3 EAST 4.3 to the log. RC 0. Session 5 checkpoint (SA05).

4 videos · ~22 min
  1. 5.1 Compile, Then Execute 5 min
  2. 5.2 The PDV and _N_ 6 min
  3. 5.3 Missing Values 6 min
  4. 5.4 Lab: The Loop and Missing Values 5 min

Decisions and loops: IF, WHERE and DO

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Five videos. IF … THEN … ELSE to compute by case, with a LENGTH statement first so that a character variable is long enough for every value. A subsetting IF keeps only the observations that pass, DELETE drops the ones that do not, and WHERE chooses rows as they are read from a data set. DO … END groups statements under one IF; iterative DO and DO WHILE loop inside one pass, and OUTPUT in a loop writes several observations.

LAB Program SIZES marks each sale BIG (50 or more, with a 5% bonus in a DO group) or SMALL, then keeps the big ones with WHERE: SOUTH 75 BIG 3.75 and WEST 120 BIG 6. RC 0. Session 6 checkpoint (SA06).

5 videos · ~28 min
  1. 6.1 IF, THEN and ELSE 6 min
  2. 6.2 LENGTH: How Many Bytes a Variable Holds 5 min
  3. 6.3 Keeping Some Rows: Subsetting IF, DELETE and WHERE 6 min
  4. 6.4 DO Groups and DO Loops 6 min
  5. 6.5 Lab: Size the Sales 5 min

Data sets on DD statements: INFILE, libraries and FILE

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Five videos. On z/OS a program’s files are named in the JCL. INFILE reads the data set on a DD — the log says which one and how many records. A libref is a DD name too: DATA SALESLIB.SALES keeps a SAS data set in a library on the SALESLIB DD, and a later job reads it back with SET, with KEEP and DROP to choose the variables. FILE and PUT with column pointers write records of your own to a data set or SYSOUT. And what the log says when a DD is missing.

LAB Program BIGFILE reads your SAS library with SET, keeps the sales over 50 and writes them with FILE and PUT to your data set userid.CS180.REPORT: three records, NORTH 75.00, SOUTH 120.00 and WEST 200.00. RC 0. Session 7 checkpoint (SA07).

5 videos · ~28 min
  1. 7.1 INFILE: Read a Data Set Named on a DD 6 min
  2. 7.2 A Libref Is a DD: Keep the Data Set 6 min
  3. 7.3 SET: Read It Back 5 min
  4. 7.4 FILE and PUT: Write Your Own Records 5 min
  5. 7.5 Lab: The Big Sales, to a Data Set 6 min

Sorting and combining: SORT, SET, MERGE and BY

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Five videos. PROC SORT orders a data set by one or more BY variables, ascending or DESCENDING, into itself or an OUT= data set. SET with two data sets stacks them; with BY it interleaves them. MERGE with BY joins observations that share a key, and IN= tells you which data set each one came from — so you can keep the matches and set the rest aside. FIRST. and LAST. mark where each BY group starts and ends.

LAB Program MANAGERS merges the sales with a table of branch managers by BRANCH and writes two data sets: REPORT, the four sales with a manager, and NOMGR, the two WEST sales without one. RC 0. Session 8 checkpoint (SA08).

5 videos · ~28 min
  1. 8.1 PROC SORT and BY 5 min
  2. 8.2 SET: Stack and Interleave 6 min
  3. 8.3 MERGE BY and IN= 6 min
  4. 8.4 FIRST. and LAST. 5 min
  5. 8.5 Lab: Sales With and Without a Manager 6 min

RETAIN, accumulators and arrays

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Four videos. Every pass starts with the variables set to missing — unless they are retained. RETAIN keeps a value from one pass to the next; the sum statement (TOTAL + AMOUNT) retains, adds and skips missing values in one go. With BY and FIRST./LAST. they make BY-group totals: reset at the first observation of a group, add on every one, output at the last. ARRAY gives one name to a row of variables so a DO loop can process them all.

LAB Program BRTOTALS sorts the sales by branch and outputs one observation per branch with its count and total: NORTH 2 87.50, SOUTH 2 123.00, WEST 2 249.99. RC 0. Session 9 checkpoint (SA09).

4 videos · ~22 min
  1. 9.1 RETAIN and the Sum Statement 6 min
  2. 9.2 BY-Group Totals 6 min
  3. 9.3 Arrays and DO 5 min
  4. 9.4 Lab: Branch Totals and Counts 5 min

Functions

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Four videos. Numeric functions — SUM, MEAN, ROUND, INT, MAX — and why SUM is not the same as +. Character functions — UPCASE, STRIP, SCAN, SUBSTR, INDEX, LENGTH and CATX. Date functions — MDY, YEAR, MONTH, WEEKDAY, INTCK and INTNX — and PUT and INPUT to turn numbers into text and text into numbers.

LAB Program STAFF reads two names and hire dates, writes each name as LAST, FIRST in capitals and computes whole years of service to 15 November 2026: LOVELACE, ADA 01MAR2016 10 and HOPPER, GRACE 20NOV2021 4. RC 0. Session 10 checkpoint (SA10).

4 videos · ~22 min
  1. 10.1 Numeric Functions 5 min
  2. 10.2 Character Functions 6 min
  3. 10.3 Date Functions, PUT() and INPUT() 6 min
  4. 10.4 Lab: Names and Years of Service 5 min

Reporting procedures: PRINT, MEANS, FREQ and SUMMARY

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Five videos. PROC PRINT with TITLE, ID, VAR, SUM and FORMAT — a listing a reader can use. PROC MEANS for the descriptive statistics of a variable. PROC FREQ for how often each value occurs, one way and crossed. PROC SUMMARY with CLASS, NWAY and OUTPUT OUT= writes statistics per group into a data set of their own, ready to print or use.

LAB Program BRANCHRPT: PROC SUMMARY totals and counts the sales per branch into a data set, PROC PRINT lists it with the title SALES BY BRANCH and the column totals 6 and 460.49, and PROC FREQ counts the branches. RC 0. Session 11 checkpoint (SA11).

5 videos · ~28 min
  1. 11.1 PROC PRINT: Titles, ID, VAR, SUM and FORMAT 6 min
  2. 11.2 PROC MEANS 5 min
  3. 11.3 PROC FREQ 6 min
  4. 11.4 PROC SUMMARY: Statistics into a Data Set 6 min
  5. 11.5 Lab: A Branch Summary Report 5 min

PROC SQL and the macro basics

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Five videos. PROC SQL reads SAS data sets as tables: SELECT, WHERE and ORDER BY print a query, GROUP BY and HAVING summarize, and CREATE TABLE keeps the result as a data set. The macro facility writes program text for you: %LET names a value and &name uses it — and the log warns when a name is not found. %MACRO with a parameter turns a few steps into one call that runs them for any branch.

LAB Program BIGBR: PROC SQL creates the table of branches whose sales add up to more than %LET MIN = 100 — SOUTH and WEST — and prints it, then a macro SHOW lists the sales of the branch it is given: %SHOW(WEST). RC 0. Session 12 checkpoint (SA12).

5 videos · ~28 min
  1. 12.1 PROC SQL: SELECT, WHERE and ORDER BY 6 min
  2. 12.2 GROUP BY, HAVING and CREATE TABLE 6 min
  3. 12.3 %LET and &name 5 min
  4. 12.4 A First %MACRO 6 min
  5. 12.5 Lab: SQL and a Macro 5 min

The final report project

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Four videos. Programs a shop keeps are members of a library: the job’s SYSIN names the member, and the job stays one step. Then one complete program of the kind shops run every night, built in stages and run at every stage: it reads the sales data set, keeps the control record aside, sorts by branch and date, writes a report with a heading, the branch totals, the grand total and the record count, checks the grand total against the control total, and prints the detail by branch. The course closes with an honest map of what comes next.

LAB Capstone (SA13): program SALESRPT, kept in your library userid.CS180.SASPGM and run by a one-step job whose SYSIN names it, reads your sales data set and writes the seven-line report: the branch totals NORTH 87.50, SOUTH 123.00 and WEST 249.99, GRAND TOTAL 460.49, RECORDS 6 and CONTROL TOTAL AGREES. RC 0.

4 videos · ~24 min
  1. 13.1 A Program Kept in a Library 6 min
  2. 13.2 The Report: BY-Group Totals with FILE and PUT 6 min
  3. 13.3 The Control Total 6 min
  4. 13.4 Capstone, and Where Next 6 min
//SKILLS  DD DSN=AFTER.THIS.COURSE

After this course, you can

//CERT    DD DSN=CS180.CERTIFICATE,DISP=(NEW,CATLG)

How the certificate is earned

CobolStack Certificate of Completion — SAS for z/OS (CS180) is issued from the lab harness’s own record of your runs — not from attendance. To earn it you must clear every gate below:

The certificate attests that you can read, write, run and debug complete SAS programs in batch on z/OS — the DATA step with every kind of INPUT, informats and formats, the PDV and missing values, data sets on DD statements, sorting and merging, BY-group totals, functions, the reporting procedures, PROC SQL and the macro basics — and read the SAS log that tells you what happened: the SAS literacy a shop needs to maintain its reports and the data feeds around its estate.

The environment

Your seat is a private, full z/OS-compatible environment with SAS in batch (the SAS cataloged procedure, SYSIN, SASLOG and SASLIST), DATA step and PROC steps, SAS data libraries and external files on DD statements, PROC SQL and the macro facility, the spool and return codes in the browser — nothing to install, snapshot and reset per exercise. By the end of the course the lab harness will have verified: thirteen SAS programs of your own run in batch — a first line in the log, two steps and a title, a first data set, a fixed record layout read with informats, a loop that shows its own missing values, sales sized with IF and DO, a library data set written to a file, sales joined to their managers, branch totals with RETAIN and FIRST./LAST., names and years of service with functions, a summary report with PROC SUMMARY and PROC FREQ, a PROC SQL table and a macro, and a branch sales report with a control total, run from your own program library at RC 0.