O'Reilly logo

SAS Certification Prep Guide: Base Programming for SAS 9, Third Edition by SAS Institute

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required