|
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
>
>
>
>
>
>
>
>
|