Creating and Modifying Variables

Overview

So far in this chapter, you've read existing data. But sometimes existing data doesn't provide the information you need. To modify existing values or to create new variables, you can use an assignment statement in any DATA step.
General form, assignment statement:
variable=expression;
where
  • variable names a new or existing variable
  • expression is any valid SAS expression
The assignment statement is one of the few SAS statements that doesn't begin with a keyword.
For example, here is an assignment statement that assigns the character value Toby Witherspoon to the variable Name:
Name='Toby Witherspoon';

SAS Expressions

You use SAS expressions in assignment statements and ...

Get SAS Certification Prep Guide: Base Programming for SAS 9, Third Edition 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.