Chapter 2: Writing Your First SAS Program

2.1  A Simple Program to Read Raw Data and Produce a Report

2.2  Enhancing the Program

2.3  More on Comment Statements

2.4  How SAS Works (a Look inside the “Black Box”)

2.5  Problems

 

2.1  A Simple Program to Read Raw Data and Produce a Report

Let’s start out with a simple program to read data from a text file and produce some basic summaries. Then we’ll go on to enhance the program.

The task: you have data values in a text file. These values represent Gender (M or F), Age, Height, and Weight. Each data value is separated from the next by one or more blanks. You want to produce two reports: one showing the frequencies for Gender (how many Ms and Fs); the other showing the average age, height, and ...

Get Learning SAS by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.