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.
Content-Type: TEXT/PLAIN; charset=US-ASCII
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 Frenkel <firstname.lastname@example.org>
> 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
> 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?