Previous Page | Next Page

SAS Component Language Dictionary

SASNAME



Verifies that a name is a valid SAS name
Category: Utility

Syntax
Details
Example

Syntax

rc=SASNAME(name);

rc

contains the return code for the operation:

1

The name is a valid SAS name.

0

The name is not a valid SAS name.

Type: Numeric

name

is the name to be verified as a valid SAS name.

Type: Character


Details

SASNAME verifies that a specified name is a valid SAS name. SAS names can be up to 32 characters long. The first character must be a letter (A, B, C, . . . , Z) or underscore (_). Other characters can be letters, numbers (0, 1, . . . , 9), or underscores. Blanks cannot appear in SAS names, and special characters (for example, $, @, #), except underscores, are not allowed.


Example

erroroff catalogname;
rc=sasname('catalogname');
if (rc=0) then do;
   erroron 'catalogname';
   _msg_= 'Catalog name is invalid.';
   end;

Note:   In this example, the value for CATALOGNAME must be a one-level SAS name. SASNAME considers a two-level name of the form libref.catalog-name invalid because it contains the dot (.) character.  [cautionend]

Previous Page | Next Page | Top of Page