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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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