BookmarkSubscribeRSS Feed
Uli
Calcite | Level 5 Uli
Calcite | Level 5
Dear All,

Please help me out of the following issue,

Input -------------------------------------output
2 ------------------------ 2.00
22 ------------------------ 22.0
100 ------------------------ 100
250.678 ------------------------ 250.678
250.6786 ------------------------ 250.679
0.0067 ------------------------ 0.0067
0.00006789------------------------ 0.00000679
0.7567 ------------------------------- 0.757


The number needs to be round to 3 significant digits. user defined function or any other solution would be great help for me.

Thanks In Advance

Best Regards
1 REPLY 1
SPR
Quartz | Level 8 SPR
Quartz | Level 8
Hello Uli,

It is a solution:
[pre]
data i;
input a;
format a E9.3;
if a LT 100 then r=INPUT(PUT(a,E9.3),15.8);
else r=INPUT(PUT(a,15.3),15.3);
datalines;
2
22
100
250.678
250.6786
0.0067
0.00006789
0.7567
run;
[/pre]
Sincerely,
SPR

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 1 reply
  • 4292 views
  • 0 likes
  • 2 in conversation