LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2000, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 30 Apr 2000 16:53:54 -0400
Reply-To:     WHITLOI1 <WHITLOI1@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         WHITLOI1 <WHITLOI1@WESTAT.COM>
Content-Type: text/plain; charset=US-ASCII

Subject: SAS V8 documentation on CD-ROM Summary: A conflict in token lengths and an editor gotcha. Respondent: Ian Whitlock <whitloi1@westat.com>

Thanks to

Ray Pass <raypass@WORLDNET.ATT.NET> Dale McLerran <dmclerra@FHCRC.ORG> Puddin' Man <pudding_man@ALTAVISTA.COM> "Fehd; Ronald J." <rjf2@CDC.GOV>

for their support in pointing out problems with the V8 Online documentation. There is still plenty of room for more people to join in. As Ray points out I am not asking for serious study, just look and point out when you use the product.

Here is one that hit my eye while perusing the SAS Macro Language Reference. Later I turned it into a search problem.

1) What is the maximum length of a token in the SAS system?

From SAS Language Reference Concepts (System Concepts - Rules for Words and Names)

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> A word or token in the SAS language is a collection of characters that communicates a meaning to SAS and is not divisible into smaller units capable of independent use. It can contain a maximum of 32,767 characters. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

From SAS Macro Language Reference (SAS Tokens)

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The maximum length of any type of token is 200 characters. A token ends when the tokenizer encounters one of the following situations:

the beginning of a new token

a blank after a name or number token

in a literal token, a quote of the same type that started the token. There is an exception. A quotation mark followed by a quotation mark of the same type is interpreted as a single quotation mark that becomes part of the literal token. For example, in 'Mary''s', the fourth quotation mark terminates the literal token. The second and third quotation marks are interpreted as a single character which is included in the literal token. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

The macro guide needs updating to the current version. Last December I posted a macro that depended on the word scanner recognizing tokens longer than 200 bytes.

2) Example from SAS Language Reference Dictionary - Systems Options

Cardimage example:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Consider the following DATA step:

data; x='A B'; run;

If CARDIMAGE is in effect, the variable X receives a value that consists of 78 characters: the A, 76 blanks, and the B. If NOCARDIMAGE is in effect, the variable X receives a value that consists of two characters: AB, with no intervening blanks. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Before the example there is this note:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Operating Environment Information: CARDIMAGE is generally used in the OS/390 and CMS operating environments; NOCARDIMAGE is used in other operating environments. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

What does one make of this? I assumed, that the assignment for X should have been on two lines instead of one. I then tried the following under *Windows 98*.

13 options nocardimage ; 14 15 data wno ; 16 x = 'a 17 b' ; 18 put "----+----+" / x $char80. ; 19 run ;

----+----+ a b NOTE: The data set WORK.WNO has 1 observations and 1 variables. NOTE: DATA statement used: real time 0.16 seconds

20 21 options cardimage ; 22 23 data wyes ; 24 x = 'a 25 b' ; 26 put "----+----+" / x $char80. ; 27 run ;

----+----+ a b NOTE: The data set WORK.WYES has 1 observations and 1 variables. NOTE: DATA statement used: real time 0.05 seconds

In addition to the mistake in presentation of the code, there seems to be something missing here. Aha! The above code was submitted using the Enhanced Editor. When using the program editor the results for CARDIMAGE were

51 options cardimage ; 52 53 data wyes ; 54 x = 'a 55 b' ; 56 put "----+----+" / x $char100. ; 57 run ;

----+----+ a b NOTE: The data set WORK.WYES has 1 observations and 1 variables. NOTE: DATA statement used: real time 0.32 seconds

When I checked the length of X it was $76 not $78, but then we really don't know what in what column "b" was placed. I am more disturbed by the discovery that the same code produces different results depending on whether the program editor or the enhanced editor was used.

For me, it is not a big problem. I never have and do not intend to take advantage of the CARDIMAGE option. But it does make me wonder what other surprises will come out of using the Enhanced editor. In general I like this editor, but still depend on TextPad for serious program writing. (The tab feature - submit only one line - threw me for a loop when I started using V8.)

Ian Whitlock


Back to: Top of message | Previous page | Main SAS-L page