## Proc format for negative numbers

Solved
Occasional Contributor
Posts: 5

# Proc format for negative numbers

Hi,

I would like to know how to use the proc format to transform my data as follow:

12.4562            to       12.46

1.232               to       01.23

-2.5                  to      -02.50

I 've tried with this :

proc format;

picture show (round)    low-high=09.99;

run;

but I loose the minus for negative numbers.

Accepted Solutions
Solution
‎02-24-2012 01:43 PM
Super User
Posts: 13,498

## Proc format for negative numbers

For your example data this works:

picture show (round)

0-high = 99.99

low - <0=099.99 (prefix='-')

;

But no guarantees for other numbers.

All Replies
Valued Guide
Posts: 765

## Re: Proc format for negative numbers

hi ... one idea ...

proc format;

value x

low-<0 = [z6.2]

other = [z5.2]

;

run;

data test;

input x @@;

format x x.;

datalines;

12.4562 1.232 -2.5

;

Obs      x

1     12.46

2     01.23

3     -02.50

Solution
‎02-24-2012 01:43 PM
Super User
Posts: 13,498

## Proc format for negative numbers

For your example data this works:

picture show (round)

0-high = 99.99

low - <0=099.99 (prefix='-')

;

But no guarantees for other numbers.

Occasional Contributor
Posts: 5

## Proc format for negative numbers

thank you very much

Frequent Contributor
Posts: 110

## Proc format for negative numbers

proc format;

picture pctpic (round) low-<0 ='009.99' (prefix='-' )

0-high='009.99'

;

run;

Use some thing like this

🔒 This topic is solved and locked.