Date: Fri, 28 Apr 2000 00:13:13 -0400
Reply-To: Tom Frenkel <taf2@IS8.NYU.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Tom Frenkel <taf2@IS8.NYU.EDU>
Subject: Re: length of variable assigned to substr function.
In-Reply-To: <e16O4.852$XB6.40969@news.uswest.net>
Content-Type: TEXT/PLAIN; charset=US-ASCII
Paula --
The rules for how the length of a character variable is decided seem
complicated to me. So to be safe, I *always* declare its length --
*before* its first use! -- with a LENGTH statement. I don't see how this
could ever do any harm. And the little bit of extra typing seems a small
price to pay for the peace of mind thus gained.
--Tom
Tom Frenkel <taf2@is8.nyu.edu>
http://pages.nyu.edu/~taf2
> There is this rountine assignment
>
> xyz = substr (uvwxyz, 1, 1);
> zyx = substr (uvwxyz, 2, 1);
> yxz =substr (uvwxyz, 3,1);
> The original variable uvwxyz is of $6. Now it is so said (not by the
> reference manual) that the length of the three new variables to the
> left of the assignment are all determined by that of the original
> UVWxyz.
> So should I use a Length statement to declare the length for them
> first? Is this generalizable to many other functions? such as
> Compress, or just a rule specific to this substr for a good reason?
|