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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

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