SAS Component Language Dictionary |
Category: | Command |
Syntax | |
Details | |
Example | |
See Also |
Syntax |
type=WORDTYPE(word-pos); |
contains one of the following word types:
The word is a SAS datetime constant such as 25AUG98:08:15:39.30.
There are no more words on the command line (end of command).
The word is a numeric constant that contains a decimal point '.', or a scientific notation 'E' for example, 6.5.
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.
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 |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.