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 1996, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 2 Apr 1996 22:59:40 +0000
Reply-To:     John Whittington <johnw@MAG-NET.CO.UK>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         John Whittington <johnw@MAG-NET.CO.UK>
Subject:      Re: Conditional Formats
Comments: To: Peter Lund <PeterL@OFM.WA.GOV>

On Tue, 2 Apr 1996, Peter Lund <PeterL@OFM.WA.GOV> wrote:

>John, et. al.- > I think everyone is agreed that, in general, you can't conditionally >assign formats in the way you describe. However, in your specific example, >wouldn't the following give you what you need: > > if y=1 then x = round(x,.01); > else x = round(x,.0001); > >I know this only works because there is a function that approximates the >format and so the concept is limited. But, in this case, it works.

Peter - not really, I'm afraid. The real trouble with this approach is that you would still have to use a W.4 format in order to be able to print either 'version' - and this format would result in 4 decimal places being printed, even if the value of x had been rounded to 0.01. For example, a value rounded to 0.04 would print as 0.0400. One point of the conditional format, as in my example, is that one can determine the number of decimal places being printed. In any event, as Peter says, this approach could not be used for most other format situations (e.g. date, character etc.).

Also, such an approach has to be done in a preceding DATA step. If one were printing directly from a permanent dataset, one would have to add a DATA step specifically for this purpose. Furthermore, this approach actually alters the value of the variable, which might not be what one wants to do.

John

----------------------------------------------------------- Dr John Whittington, Voice: +44 1296 730225 Mediscience Services Fax: +44 1296 738893 Twyford Manor, Twyford, E-mail: johnw@mag-net.co.uk Buckingham MK18 4EL, UK CompuServe: 100517,3677 -----------------------------------------------------------


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