Date: Fri, 28 Apr 2000 14:54:54 +0100
Reply-To: John Whittington <John.W@MEDISCIENCE.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: John Whittington <John.W@MEDISCIENCE.CO.UK>
Subject: Re: length of variable assigned to substr function.
In-Reply-To: <200004281325.OAA02906@vicar.netnames.net>
Content-Type: text/plain; charset="us-ascii"
At 08:19 28/04/00 -0500, Workman, Robert wrote:
>Unfortunately it doesn't seem to be that simple when using functions to set
>the initial value of the variables. "The rule" holds true when using
>assignment statements to assign a literal string to the variable. However,
>different functions seem to have different rules for determining the length.
Robert, yes, you're dead right - and Ian W has explained the 'thinking'
that the SAS compiler uses when the first encounter with a variable is an
assignment with the value returned by a function like SUBSTR() - I had
never noticed that the compiler was so 'clever'!
However, I think the bottom line still remains the same - that, unless one
is sure that one knows what one is doing, and equally sure of all possible
ata situations, one is advised to explicitly define the length of a
character variable that has not come from another data set.
Thanks for pointing out my error!
Kind Regards,
John
----------------------------------------------------------------
Dr John Whittington, Voice: +44 (0) 1296 730225
Mediscience Services Fax: +44 (0) 1296 738893
Twyford Manor, Twyford, E-mail: John.W@mediscience.co.uk
Buckingham MK18 4EL, UK mediscience@compuserve.com
----------------------------------------------------------------
|