## PROC FORMAT for percentage format

Solved
Occasional Contributor
Posts: 15

# PROC FORMAT for percentage format

I used following syntex to format the number to percentage. However for number of 0.858369, it gives 85%. Is there a way to get correct percetage of 0.85%?

proc format library = fmt;

picture pctfmt low-high='000.00%';

run;

Thanks!

Regards,

Weizhong

Accepted Solutions
Solution
‎10-19-2013 01:16 AM
Posts: 1,147

## Re: PROC FORMAT for percentage format

Hi,

Please try the below picture format

proc format;

picture val low-high='9.99%';

run;

data class;

val=put(0.858369,val.);

run;

Thanks,

Thanks,
Jag

All Replies
Solution
‎10-19-2013 01:16 AM
Posts: 1,147

## Re: PROC FORMAT for percentage format

Hi,

Please try the below picture format

proc format;

picture val low-high='9.99%';

run;

data class;

val=put(0.858369,val.);

run;

Thanks,

Thanks,
Jag
Occasional Contributor
Posts: 15

## Re: PROC FORMAT for percentage format

However my data mixed of numbers such as 20, 100 and 0.858369. If there way to wark around? Thanks!

Posts: 1,147

## Re: PROC FORMAT for percentage format

in that case you can use the below picture format

proc format fmtlib;

picture val low-<1='9.99%'

1<-high='009%';

run;

Thanks,

Thanks,
Jag
Posts: 3,852

Posts: 1,147

## Re: PROC FORMAT for percentage format

Thank you data_null_, please find below my corrected code

proc format fmtlib;

picture val low-<1='9.99%'

1-high='009%';

run;

Thanks,

Thanks,
Jag
Posts: 3,852

## Re: PROC FORMAT for percentage format

What about the sign if the value is negative?

Posts: 1,147

## Re: PROC FORMAT for percentage format

Thank you data_null_, updated the picture format to consider the negative values

proc format fmtlib;

picture val low-<0='09.99%' (prefix='-')

0-<1='09.99%'

1-high='009%';

run;

Thanks,

Thanks,
Jag
Posts: 3,852