Chapter Contents

Previous

Next
WORDTYPE

WORDTYPE



Identifies the word type of a word on the command line

Category: Command


Syntax
Details
Example
See Also

Syntax

type=WORDTYPE(word-pos);

type
contains one of the following word types:

DATE
The word is a SAS date constant such as 25AUG98.

DATETIME
The word is a SAS datetime constant such as 25AUG98:08:15:39.30.

EOD
There are no more words on the command line (end of command).

INTEGER
The word is an integer such as 6.

LABEL
The word type is unknown to the SAS tokenizer.

NAME
The word is a SAS name such as DATA.

NUMBER
The word is a numeric constant that contains a decimal point '.', or a scientific notation 'E' for example, 6.5.

SEMI
The word is a semicolon.

SPECIAL
The word is a special operator such as '=', '+', and so on.

STRING
The word is a character string such as MYDATA.

TIME
The word is a SAS time constant such as 08:16:30.

UNKNOWN
The word type is unknown to the SAS tokenizer.

Type: Character

word-pos
is the position of the word to be retrieved from the command line. Specify either 1, 2, or 3 for the first, second, or third word.

Type: Numeric


Details

WORDTYPE returns the type of the first, second, or third word that is currently on the command line. A word is the text at the current position and up to the end of a leading number or the next blank or semicolon. You can use this function with WORD.

To support custom commands in your application, you must use a CONTROL statement with either the ENTER, ALWAYS, or ALLCMDS option specified. When CONTROL ALWAYS is specified, words entered on the command line that are not valid SAS commands are not flagged in error. See CONTROL for information about the advantages of each CONTROL statement option before deciding which is best for your application.


Example

Return the type of the four words that are currently on the command line:

w1=word(1); w1type=wordtype(1); put w1= w1type=;
w2=word(2); w2type=wordtype(2); put w2= w2type=;
w3=word(3); w3type=wordtype(3); put w3= w3type=;
CALL NEXTWORD();
w4=word(3); w4type=wordtype(4); put w4= w4type=;

If a user types ABC = 3 9 on the command line, then this program produces the following output:

w1=ABC w1type=NAME
w2==w2type=SPECIAL
w3=3 w3type=INTEGER
w4=9 w4type=INTEGER

See Also

CONTROL

NEXTWORD

WORD


Chapter Contents

Previous

Next

Top of Page

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