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 (February 2011, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 2 Feb 2011 15:46:08 -0800
Reply-To:   Sterling Paramore <gnilrets@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Sterling Paramore <gnilrets@GMAIL.COM>
Subject:   Re: SAS format question: Forcing display of no decimal places and two decimal places
In-Reply-To:   <480923.25778.qm@web161607.mail.bf1.yahoo.com>
Content-Type:   text/plain; charset=ISO-8859-1

Formats can only be applied to a whole column and cannot be dependent on values from another column. However, if you don't care if the result is text or numeric, how about this:

data want; set test;

length disp $16; if statistic = "N" then disp = left(put(value,16.0)); else disp = left(put(value,16.2)); run;

On Wed, Feb 2, 2011 at 3:30 PM, Paul Miller <pjmiller_57@yahoo.com> wrote:

> Hello Everyone, > > I'm struggling with a formatting problem. I want to force SAS to display no > decimal places for a treatment variable when statistic = 'N' and 2 decimal > places otherwise. Thought I might need a picture format but haven't been > able to come up with anything that works. > > Suppose I have data that look something like: > > data test; > input statistic $ value; > format value 12.6; > cards; > N 120 > StdDev 80.80 > ; > > How can I get SAS to display the numbers as 120 and 80.80 (not 80.8)? I > don't care if the column I use to make my output table is character or > numeric. > > Thanks, > > Paul > > > > > > > >


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