Date: Mon, 5 Dec 2005 14:10:19 -0500
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: Length of variable
On Mon, 5 Dec 2005 10:51:32 -0500, Michael S. Zdeb
<msz03@HEALTH.STATE.NY.US> wrote:
>Hi...the FORMAT has nothing to do with the LENGTH. The length is set
>either in a LENGTH statement of by the INFORMAT used to read the variable
>value. How did you read the data to create tha data set?
I would put that differently. The format has nothing to do with the length
if the length is already determined when the compiler encounters the FORMAT
(or ATTRIB) statement. When I run
data test;
format x $23.;
x = 'a';
run;
X has a length of 23, but if I reverse the order of the FORMAT and
assignment statements, it has a length of 1.
>
>
>Mike Zdeb
>U@Albany School of Public Health
>1 University Drive
>Rensselaer, NY 12144-3456
>(P)518-402-6479
>(F)630-604-1475
>
>
>
> "Sridhar, Kumar"
> <nsridhar@MEDAREX
> .COM> To
> Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU
> Discussion" cc
> <SAS-L@LISTSERV.U
> GA.EDU> Subject
> Length of variable
>
> 12/05/2005 10:48
> AM
>
>
> Please respond to
> "Sridhar, Kumar"
> <nsridhar@MEDAREX
> .COM>
>
>
>
>
>
>
>Hi all:
>
> I have a dataset in which I defined the format for the
>variable comment as $200. But when I see the length (thru' proc
>contents) it has 202. I am just curious why the length is longer than
>the format. I checked the length of the longest comment and found it to
>be 200.
>
>
>
>
>
>Any suggestions would, as always, be appreciated.
>
>
>
>
>
>Regards
>
>
>
>Kumar