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 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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.
Comments: To: paula <icj808@USWEST.NET>
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?


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