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 (May 2002, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments: To: Avikam Nuriel <mshope@CC.HUJI.AC.IL>
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 of variable.

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.

Sig

-----Original Message----- From: Avikam Nuriel [mailto:mshope@CC.HUJI.AC.IL] Sent: Monday, May 06, 2002 8:23 AM To: SAS-L@LISTSERV.UGA.EDU Subject: leading zeros

Hi, 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.


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