IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to match ZD15.3 to ZD15.2 in SAS?


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
lee_issc

New User


Joined: 11 Dec 2008
Posts: 33
Location: China

PostPosted: Thu Apr 26, 2012 7:54 am
Reply with quote

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
View user's profile Send private message
lee_issc

New User


Joined: 11 Dec 2008
Posts: 33
Location: China

PostPosted: Thu Apr 26, 2012 8:54 am
Reply with quote

anybody knows that?pls!
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Apr 26, 2012 10:03 am
Reply with quote

do not solicit for answers!

replying is ...
on voluntary base
on our own time
free of charge

from Your profile...
Quote:
referer: my+manager
icon_evil.gif

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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Thu Apr 26, 2012 11:20 am
Reply with quote

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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Thu Apr 26, 2012 11:36 am
Reply with quote

or
Code:
AMOUNT=FLOOR(AMOUNT*100)/100;
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Apr 26, 2012 2:31 pm
Reply with quote

Or the ROUND function, perhaps? If not ROUND, then CEIL or FLOOR will surely do what you want.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts JOINKEYS to match two input files on ... DFSORT/ICETOOL 3
No new posts Print next line strings when a condit... DFSORT/ICETOOL 9
No new posts Match two files using multiple keys a... SYNCSORT 11
No new posts Match records - DFSORT/ICETOOL 6
No new posts JCL sort Match and NoMatch SYNCSORT 2
Search our Forums:

Back to Top