BookmarkSubscribeRSS Feed
amber7391
Fluorite | Level 6

Hi genius SAS people.

Can anyone help me with some truncate problem. I really appreciate it!

 

I have a dataset-->have as the following.

 

have 
idprobability
11.23
12.345
11
10.222
21
22
31.6678
40.8987
51.2345
50.4566
51.44888

 

Now, I want to multiply the probabilities and group by id. Also, I need to truncate the decimal places to 10 decimal places without rounding.

The following is how I want my result look like. Also, I would like to apply the truncate function to the whole column.

 

idprobabilitywant  
11.23*2.345*1*0.2220.6403257  
21*22  
31.66781.6678  
40.89870.8987  
51.2345*0.4566*1.448880.816694101576<--0.8166941015
2 REPLIES 2
Tom
Super User Tom
Super User
int(value*10**10)/10**10
Ksharp
Super User
proc format ;
picture fmt
 low-hight='9.0000000000';
run;
data x;
input x;
format x fmt20.10;
cards;
0.6403257	 	 
2	 	 
1.6678	 	 
0.8987	 	 
0.816694101576
;

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

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 3064 views
  • 0 likes
  • 3 in conversation