Introduction to SAS [7-19]

h

Creating Character Variables

Unlike other programming languages such as R, Java or C++, there are only two types of variable in SAS:

  • Numeric
  • Character

Creating a character variable is easy. You simply need to enclose them with a quotation mark. 

Either single quotation ('John') or double quotation ("John") works. 

Example

Data Test;
    Name = "John";
    Class = "Mathematics";
Run;

This DATA Step will create two character variables: Name and Class. They both contain character values.

(Try it!)

? Sign up for a free SASCrunch account now and keep track of your learning progress!


Exercise

Create a data set that contains the following variables:

Restaurant: Burger King
NumEmploy: 5
Location: Toronto

Name the data set as Food

Need some help?

Get Hint

Get Solution