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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 4234 views
  • 0 likes
  • 2 in conversation