BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Fontaines03
Calcite | Level 5

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.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

For your example data this works:

picture show (round)

0-high = 99.99

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

;

But no guarantees for other numbers.

View solution in original post

4 REPLIES 4
MikeZdeb
Rhodochrosite | Level 12

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

ballardw
Super User

For your example data this works:

picture show (round)

0-high = 99.99

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

;

But no guarantees for other numbers.

Fontaines03
Calcite | Level 5

thank you very much

sassharp
Calcite | Level 5

proc format;

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

0-high='009.99'

;

run;

Use some thing like this

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 6263 views
  • 0 likes
  • 4 in conversation