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-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!

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