BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
3 REPLIES 3
deleted_user
Not applicable
> 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
deleted_user
Not applicable
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
deleted_user
Not applicable
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
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1308 views
  • 0 likes
  • 1 in conversation