". ".
parse var name fn init ". " ln
strngptrn=". "
parse var name fn init (strngptrn) ln
/* Using a variable as a string pattern */
/* The variable (delim) is set in the same template */
SAY "Enter a date (mm/dd/yy format). =====> " /* assume 11/15/98 */
pull date
parse var date month 3 delim +1 day +2 (delim) year
/* Sets: month="11"; delim="/"; day="15"; year="98" */
/* Using a variable as a positional pattern */
dataline = "12 26 .....Samuel ClemensMark Twain"
parse var dataline pos1 pos2 6 =(pos1) realname =(pos2) pseudonym
/* Assigns: realname="Samuel Clemens"; pseudonym="Mark Twain" */
6 is needed in
the template for the following reason: Word parsing occurs after the language
processor divides the source string into substrings using patterns. Therefore,
the positional pattern =(pos1) cannot be
correctly interpreted as =12 until after the
language processor has split the string at column
6 and assigned the whitespace-delimited words 12
and 26 to
pos1 and
pos2, respectively.