BookmarkSubscribeRSS Feed
HeatherNewton
Quartz | Level 8

what is s370fpd8.7 format, I read the documentation but not getting it

in my data I am getting 2 decimal points but not sure what the informats had done any rounding truncating in reading the data as I dont have the source text file.. 

2 REPLIES 2
s_lassen
Meteorite | Level 14

A packed decimal format is a format consisting of hexadecimal numbers, e.g. "132431"x -> 132431. The format was used quite a lot in the older days, when the time it took to convert a number from hexadecimal to decimal representation actually mattered. If you are not on the mainframe, your input variable may not look like pure numbers, as mainframe data are in EBCDIC, not ASCII representation. Also, there is a sign (at the end if I remember correctly, which will look something like a hexadecimal "C" or "F").

 

When you read data with the s370fpd8.7 informat, SAS reads 8 bytes, which are translated to 15 digits and a sign, the last 7 digits are considered to be decimals. When you get 2 decimals on the output, it is either because the last 5 digits in all numbers are zeros, or because your SAS program has put a format, e.g. 15.2 on the output variable.

Kurt_Bremser
Super User

Just to give you some background: this method is called BCD, for Binary Coded Decimal. Each nibble (4 bits) holds a decimal digit, can easily be used in binary calculations, but is still simply readable by humans when displayed in hex formatting (which IBM mainframe file viewers usually do). And space consumption is half of what you need when every byte (8 bits) holds a digit.

 

All the S370xxxx formats and informats are designed to handle numeric data originating from (or being sent to) IBM mainframes.

Similarly, the $EBCDIC character (in)formats encode/decode text being used on mainframes.

EBCDIC stands for Extended Binary Coded Decimal Interchange Code.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 162 views
  • 1 like
  • 3 in conversation