The SAS Output Delivery System and reporting techniques

Proc Format

Reply
N/A
Posts: 0

Proc Format

Hi ,
I have used the following proc fromat for displaying some percentage values with + or - in decimals.(Eg: +7.7 , -0.8 etc).But this proc format works only for values greater than or less than 0. But i need to display the format for the value 0 also.( like +0.0 or -0.0).
PROC FORMAT;
PICTURE plusmin low -< 0 = '0,009.9' (prefix = '- ' )
0 <- high = '0,009.9' ( prefix = '+ ' )
;
Please help me ASAP.
Thanks,
Sandhya
N/A
Posts: 0

Re: Proc Format

> Hi ,
> I have used the following proc fromat for displaying
> some percentage values with + or - in decimals.(Eg:
> +7.7 , -0.8 etc).But this proc format works only for
> values greater than or less than 0. But i need to
> display the format for the value 0 also.( like +0.0
> or -0.0).
> PROC FORMAT;
> PICTURE plusmin
> low -< 0 = 0009.9 (prefix = '-' )
> 0 <- high = '0,009.9' ( prefix = '+ ' )
> Please help me ASAP.
> Thanks,
> Sandhya
N/A
Posts: 0

Re: Proc Format

You were nearly there! Try this code:

PROC FORMAT;
PICTURE PLUSMIN
LOW-<0="0,009.9" (PREFIX="-")
0-HIGH="0,009.9" (PREFIX="+");
RUN;

Note that you will need to associate the format with a variable using a width e.g. FORMAT NUMBER PLUSMIN8.;
to give extra room at the front for four-digit values, otherwise you lose the '+' sign.

Robert
N/A
Posts: 0

Re: Proc Format

Sorry, due to technical problems, my earlier reply was truncated. Here follows the full text.

You were nearly there! Try this code:

PROC FORMAT;
PICTURE PLUSMIN
LOW -< 0="0,009.9" (PREFIX="-")
0-HIGH="0,009.9" (PREFIX="+");
RUN;

Note that you will need to associate the format with a variable using a width e.g.
FORMAT NUMBER PLUSMIN8.;
to give extra room at the front for four-digit values, otherwise you lose the '+' or '-' sign.

Robert
Ask a Question
Discussion stats
  • 3 replies
  • 138 views
  • 0 likes
  • 1 in conversation