Chapter Contents

Previous

Next
SAS Component Language: Reference

Constants

In SCL, a constant (or literal) is a fixed value that can be either a number or a character string. Constants can be used in many SCL statements, including assignment and IF-THEN statements. They can also be used as values for certain options.


Numeric Constants

A numeric constant is a number that appears in a SAS statement, and it can be presented in the following forms:


Character Constants

A character constant can consist of 1 to 32,767 characters and must be enclosed in quotation marks. Character constants can be represented in the following forms:

If a character constant includes a single quotation mark, then either write the quotation mark as two consecutive single quotation marks or surround the entire value with double quotation marks, as shown in the following examples:

possession='Your"s';
company="Your's and Mine"
company="Your""s and Mine"
To use a null character value as an argument to a function in SCL, either use '' (without a space) or use a blank value with ' ' (with a space).


Numeric-to-Character Conversion

If a value is inconsistent with the variable's data type, SCL attempts to convert the value to the expected type. SCL automatically converts character variables to numeric variables and numeric variables to character variables, according to the following rules:

When a variable is converted automatically, a message in the LOG window warns you that the conversion took place. If a conversion from character to numeric produces invalid numeric values, then a missing value is assigned to the result, an error message appears in the LOG window, and the value of the automatic variable _ERROR_ is set to 1.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.