DATA Step, Macro, Functions and more

Reading and displaying Zoned decimal S9(13)V99

Reply
N/A
Posts: 0

Reading and displaying Zoned decimal S9(13)V99

Here is the code fragment I used in IBM Mainframe to read Zoned decimal data in the format S9(13)V99

OPTIONS NOCENTRE;
DATA FILE1;
INFILE INPUT1;
INPUT @51 REW_AMT ZD15.2;
PROC PRINT DATA=FILE1;

The REW_AMT in the input file looks
5----+----6----+
****************
00000000001630{
00000000009630{
00000000006630{
00000000005630{
00000000003630{

The SASLIST has correct output but surprisingly for some of the observations, the REW_AMT field is in floating point format (observation 5). We are using SAS 8.2 version.

Obs REW_AMT

1 163
2 963
3 663
4 563
5 363.00

Please help me in fixing the error.
Super Contributor
Super Contributor
Posts: 3,174

Re: Reading and displaying Zoned decimal S9(13)V99

Define a SAS FORMAT statement, either in the DATA step or with PROC PRINT execution. Using the SEARCH facility at the SAS support http://support.sas.com/ website, I found the link below:

Working with Packed Decimal and Zoned Decimal Data
http://v8doc.sas.com/sashtml/lrcon/z1265705.htm

Also, you really should consider upgrading SAS to a more current (and fully supported) version in the near future.

Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 1 reply
  • 255 views
  • 0 likes
  • 2 in conversation