Date: Mon, 6 May 2002 09:16:40 -0400
Reply-To: Sigurd Hermansen <HERMANS1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Sigurd Hermansen <HERMANS1@WESTAT.COM>
Subject: Re: leading zeros
Content-Type: text/plain; charset="iso-8859-1"
Much the same question arose last week in the context of binary numbers.
Once again, the way SAS stores numbers differs from the way it displays
numbers. SAS reverts to a default format when programmers do not specify a
format, but a format does not change the underlying representation of a
number in a SAS dataset. The LENGTH of a number merely limits the level of
precision that SAS can provide when displaying the value in a numeric type
The default LENGTH for numeric variables provides an adequate level of
precision for almost all circumstances. You then have the option to choose
whatever format you need to produce an appropriate appearance and level of
precision you need. In a program you can specify different formats for
different purposes without changing the value stored in a SAS dataset, or
you can specify a default format in the catalog of a dataset. You can also
use a format in a PUT() statement or function to convert a number in a SAS
dataset to specific form of character representation in an output dataset,
file, or object.
From: Avikam Nuriel [mailto:mshope@CC.HUJI.AC.IL]
Sent: Monday, May 06, 2002 8:23 AM
Subject: leading zeros
I have variable in different length (i.e 23 320 1 23 and so on)
and I need to put leading zeros.
I can do that with:
put @1 var z4.;
(I get 0023 0320 0001 023)
The problem is I can't create new file including
this variable with leading zeros.
your advise pleas.