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..
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.
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.
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!
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.
Ready to level-up your skills? Choose your own adventure.