View previous topic :: View next topic
|
Author |
Message |
lee_issc
New User
Joined: 11 Dec 2008 Posts: 33 Location: China
|
|
|
|
Dears,
These dasy I am confused on SAS decimal postion match problem. For example, I read a file in,
Code: |
DATA MDQLCBIT;
INFILE MDQLCBIT;
INPUT @011 PROD_TYPE $CHAR04.
@040 CCY_CODE $CHAR03.
@072 AMOUNT ZD15.3
@155 ACTION_TYPE $CHAR06.
; |
and wanna to change this AMOUNT to ZD15.2 thru below ways:
FORMAT AMOUNT ZD15.2 or FORMAT 15.2
all are failed. like 678.569 will be rounded to 678.57 which is error. I wanna it to be 678.56. just cut 2 decimal bytes. |
|
Back to top |
|
|
lee_issc
New User
Joined: 11 Dec 2008 Posts: 33 Location: China
|
|
|
|
anybody knows that?pls! |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
do not solicit for answers!
replying is ...
on voluntary base
on our own time
free of charge
from Your profile...
Quote: |
referer: my+manager |
if You and Your manager have time issues
a forum is not the best place to seek for help
wiser to hire a paid consultant who, for the proper fee, will be glad to
satisfy Your time constraints
( a manager with a normal IQ would have had You trained, not referred to a forum ) |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Will this statement suffice?
Code: |
AMOUNT = INT(AMOUNT*100)/100; |
Code: |
input output
11.2345 11.23
12.5678 12.56
15.9699 15.96 |
|
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
or
Code: |
AMOUNT=FLOOR(AMOUNT*100)/100; |
|
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Or the ROUND function, perhaps? If not ROUND, then CEIL or FLOOR will surely do what you want. |
|
Back to top |
|
|
|