Creating Variables

Assignment Statements

Use an assignment statement in any DATA step in order to modify existing values or create new variables.
Syntax, assignment statement:
  • variable names a new or existing variable
  • expression is any valid SAS expression
Tip:The assignment statement is one of the few SAS statements that do not 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 many other SAS programming statements to do the following:
  • transform variables
  • create new variables
  • conditionally process ...

Get SAS Certification Prep Guide, 5th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.