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 (July 2002, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 30 Jul 2002 17:54:39 +0100
Reply-To:   Peter Crawford <peter.crawford@DB.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Peter Crawford <peter.crawford@DB.COM>
Subject:   real numbers in syntax (was Re: piece of code from TS-659)
Content-type:   text/plain; charset=iso-8859-1

I've changed this subject because the point I want to follow up has very little connection with TS-659 (even thought it gave me trouble too, when I copied it and used "submit clipboard")

I really would like to follow up about using real numbers as a value in base sas syntax.

OK so it looks strange to see a 12 character variable defined as length xvar $ 0Cx ; but it would be an improvement if this freedom to define length Lvar $ 1e4 ; * 10k wide variable ; was available in array definitions like array hash(1e8) _temporary_ ; That has an easily read and understood dimension size but it is invalid (!!!!!!!) because here (array dimension), the syntax parser does NOT accept real numbers !

I would not wish to change or limit validation of variable length to integers, quite as much as I would like an array dimension to be "real"

Regards Peter Crawford

Datum: 30/07/2002 11:40 An: SAS-L@LISTSERV.UGA.EDU

Antwort an: Wolf Lesener <wflesener@RZ.HU-BERLIN.DE>

Betreff: Re: piece of code from TS-659 Nachrichtentext:

Dear Jack, Arjen and all the other involved in the discussion about LENGTH specification,

primarily let me excuse for my poor English. May be it sounds stronger than I meant but I'm not a native speaker. I don't want any personal attack, neither against Jack nor the writer of TS-659.

Jack Hamilton wrote in his last mail:

At 11:11 29.07.2002 -0600, you wrote: I think there's a confusion in your understanding of SAS syntax. "$12." does follow the syntax given in the documentation.

The Dictionary manual's definition of the length declaration for a character variable is a dollar sign followed by a numeric constant. That is correct. You can see it at LENGTH statement explanation in the OnlineDoc.

Otherwise if you look at the index of the OnlineDoc you will find under LENGTH statement "LENGTH" A2000, CMS, LGREF, OS2, OS390, SCLR, UNIXC, VMS, WIN; " When selecting WIN you'll find a different definition: LENGTH <variable-1><...variable-n> <$> <length> <DEFAULT=n>; This definition doesn't explain the term <length> as a numeric constant. May be it uses a different term to make a difference between length attributes and numeric constants (?) - but it doesn't explain the difference.

The Concepts manual says "Numeric constants expressed in standard notation can be integers, can be specified with or without a plus or minus sign, and can include decimal places". That is also correct.

You might want the definition to be "decimal integer with no decimal point", but it's not. Yes, this was in my mind. The reason, I think is very closely: Any length attribute (in this context) can be an integer only.

Personally, I like the current definition. I know that anywhere I want to put a decimal number, I can include a decimal place without thinking about it, and I think that's a good thing.

All of the following are valid and have the same meaning. I was surprised by the last one (which I discovered this morning), but SAS is being consistent.

length x $12; length x $12.; length x $ 12.; length x $ 12.; length x $ 0bx;

But if we consider again the definition of a numeric constant referred from LENGTH statement syntax description: "Numeric constants expressed in standard notation can be integers, can be specified WITH OR WITHOUT A PLUS OR MINUS SIGN, and can include decimal places". The following code should per definition to be ok, but it doesn't work:

LENGTH t0 $+12; LENGTH t1 $ +12; LENGTH t2 $ +12.;

Please don't ask about the meaning of my sign. This question leads directly to the meaning of the dot ...

And now let's obtain some further seems to me at least partial curious results.

LENGTH t3 $12.0; works (ok, that's only another form of 12.) LENGTH t4 $12.7; works also (?!) by the way: without rounding and without any NOTE or WARNING LENGTH t5 $1.2E1; works (not only standard notation, scientific notation works also)

My conclusion: I've learned (thank you Jack) that it is possible to code a length attribute using a real constant. It is obviously not an error or mistake. But I can't agree that the real notation delivers any advantage and has to be liked or preferred. Any length in bytes is an integer number and you loose some transparency using real coded length attributes.

Thanks and really good times to all participants of the LENGTH-discussion

Mit freundlichen Gruessen Ihr Wolf F. Lesener

Humboldt-Universitaet zu Berlin - Rechenzentrum - Unter den Linden 6 10099 Berlin Tel. (030) 2093 2464 Fax. (030) 2093 2959

--

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


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