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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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