Converting User-Written Formats from Earlier Releases to SAS 9.1


Converting User -Written Formats from Earlier Releases to SAS 9.1

You must convert Release 6.09E and Release 6.12 user-written formats to their SAS 9.1 counterparts before you can use them in a SAS 9.1 program. You can convert these catalogs by using the CPORT and CIMPORT procedures. For more information on the CPORT and CIMPORT procedures, see Base SAS Procedures Guide .

HEXw. Format

Converts real binary (floating-point) values to hexadecimal values

Category numeric

Width range: 1-16

Default width: 8

Alignment: left

Windows specifics: native floating-point representation

See: HEXw. in SAS Language Reference: Dictionary

Syntax

HEX w .

w

  • specifies the width of the output field. When you specify a w value of 1 through 15, the real binary number is truncated to a fixed-point integer before being converted to hexadecimal notation. When you specify 16 for the w value, the floating-point value of the number is used; in other words, the number is not truncated.

See Also
  • '$HEX w . Format' on page 377

  • 'HEX w . Informat' on page 415

$HEXw. Format

Converts character values to hexadecimal values

Category character

Width range: 1-32767

Default width: 4

Alignment: left

Windows specifics: ASCII character-encoding system

See: $HEXw. in SAS Language Reference: Dictionary

Syntax

$HEX w .

w

  • specifies the width of the output field.

Details

The $HEX w . format is like the HEX w . format in that it converts a character value to hexadecimal notation, with each byte requiring two columns . Under Windows, the $HEX w . format produces hexadecimal representations of ASCII codes for characters .

See Also
  • 'HEX w . Format' on page 376

  • '$HEX w . Informat' on page 416

IBw.d Format

Writes integer binary (fixed-point) numbers

Category numeric

Width range: 1-8

Default width: 4

Decimal range: 0-10

Alignment: left

Windows specifics: native floating-point representation

See: IBw.d in SAS Language Reference: Dictionary

Syntax

IB w . d

w

  • specifies the width of the output field in bytes (not digits).

d

  • optionally specifies a scaling factor. When you specify a d value, the IB w . d format multiplies the number by 10 d , and then applies the integer binary format to that value.

Details

The IB w . d format converts a double-precision number and writes it as an integer binary (fixed-point) value. Integers are stored in integer-binary (fixed-point) form.

For more information about microcomputer fixed-point values, see Intel's developer Web site.

Examples
Example 1: Processing a Positive Number

If you format 1.0 as the double-precision number, it is stored as an integer:

 01 00 00 00 00 00 00 00 

(Remember, Windows stores binary data in byte- reversed order.) The value written depends on the w value you specify.

If you specify the IB4. format, you receive the following value:

 01 00 00 00 

If you specify the IB2. format, you receive the following value:

 01 00 
Example 2: Processing a Negative Number

If you try to format -1 with the IB4. format, you receive the following value:

 FF FF FF FF 

If you specify the IB2. format, you receive the following value:

 FF FF 
Example 3: Processing a Number

That Is Too Large to Format When a numeric value is too large to format, the result is largest interger value that can be stored in four bytes, which is 2,147,483,647.

In the following code

 data a;     x = 9999999999999999999;     y = put(x, IB8.);     put y = hex16.;  run; 

SAS returns the hexadecimal representation of 2147483647

 y=FFFFFFFFFFFFFF7F 
See Also
  • 'IB w . d Informat' on page 416

  • 'Writing Binary Data' on page 375

PDw.d Format

Writes packed decimal data

Category numeric

Width range: 1-16

Default width: 1

Decimal range: 1-31

Alignment: left

Windows specifics: How the values are interpreted as negative or positive

See: PDw.d in SAS Language Reference: Dictionary

Syntax

PD w . d

w

  • specifies the width of the output field in bytes (not digits).

d

  • optionally specifies a scaling factor. When you specify a d value, the PD w . d format multiplies the number by 10 d , and then applies the packed decimal format to that value.

Details

The PD w . d format writes double-precision numbers in packed decimal format. In packed decimal data, each byte contains two digits. The w value represents the number of bytes, not the number of digits. The value's sign is in the uppermost bit of the first byte (although the entire first byte is used for the sign).

Examples
Example 1: Processing a Positive Number

If you format 1143.0 using the PD2. format, you receive the following value:

 00 43 

If you specify PD4., you receive the following value:

 00 00 11 43 
Example 2: Processing a Negative Number

If you format -1143.0 using the PD2. format, you receive the following value:

 80 43 

If you specify the PD4. format, you receive the following value:

 80 00 11 43 
Example 3: Processing a Number That Is Too Large To Format

When a numeric value is too large to format, as in this example

 data a;     x = 1i308;     y = put(x, PD16.2);     put y = hex16.;  run; 

the result is

 y=0099999999999999 
See Also
  • 'PD w . d Informat' on page 418

  • 'Writing Binary Data' on page 375

PIBw.d Format

Writes positive integer binary data

Category numeric

Width range: 1-8

Default width: 1

Decimal range: 0-10

Alignment: left

Windows specifics: native byte-swapped integers

See: PIBw.d in SAS Language Reference: Dictionary

Syntax

PIB w . d

w

  • specifies the width of the output field in bytes (not digits).

d

  • optionally specifies a scaling factor. When you specify a d value, the PIB w . d format multiplies the number by 10 d , and then applies the positive integer binary format to that value.

Details

The PIB w . d format converts a fixed-point value to an integer binary value. If the fixed-point value is negative, the PIB w . d format writes the integer representation for -1.

For more information about microcomputer fixed-point values, see Intel's developer Web site.

Examples
Example 1: Processing a Number That Is Too Large To Format

When a numeric value is too large to format, the result is the largest integer value that can be stored in four bytes, which is 2,147,483,647.

In the following code

 data a;     x = 9999999999999999999;     y = put(x, PIB8.);     put y = hex16.;  run; 

SAS returns the hexadecimal representation of 2147483647

 y=FFFFFFFFFFFFFF7F 
See Also
  • 'PIB w . d Informat' on page 418

  • 'Writing Binary Data' on page 375

RBw.d Format

Writes real binary (floating-point) data

Category numeric

Width range: 2-8

Default width: 4

Decimal range: 0-10

Alignment: left

Windows specifics: native floating-point representation

See: RBw.d in SAS Language Reference: Dictionary

Syntax

RB w . d

w

  • specifies the width of the output field.

d

  • optionally specifies a scaling factor. When you specify a d value, the RB w . d format multiplies the number by 10 d , and then applies the real binary format to that value.

Details

The RB w . d format writes numeric data in real binary (floating-point) notation. Numeric data for scientific calculations are commonly represented in floating-point notation. (SAS stores all numeric values in floating-point notation.) A floating-point value consists of two parts : a mantissa that gives the value and an exponent that gives the value's magnitude.

Real binary is the most efficient format for representing numeric values because SAS already represents numbers this way and no conversion is needed.

For more information about Windows floating-point notation, see Intel's developer Web site.

Examples
Example 1: Processing a Number That Is Too Large To Format

When a numeric value is too large to format, as in this example

 data a;     x = 1i308;     y = put(x, RB8.2);     put y = hex16.;  run; 

the result is

 y=0000000000D1FFFF 
See Also
  • 'RB w . d Informat' on page 420

  • 'Writing Binary Data' on page 375

ZDw.d Format

Writes zoned decimal data

Category numeric

Width range: 1-32

Default width: 1

Decimal range: 1-10

Alignment: left

Windows specifics: Last byte includes the sign.

See: ZDw.d in SAS Language Reference: Dictionary

Syntax

ZD w . d

w

  • specifies the number of bytes (not the number of digits).

d

  • optionally specifies the number of digits to the right of the decimal point in the numeric value.

Details

The ZD w . d format writes zoned decimal data. This is also known as an overprint trailing numeric format. In the Windows operating environment, the last byte of the field contains the sign information of the number. The following table gives the conversion for the last byte.

Digit

ASCII Character

Digit

ASCII Character

{

-0

}

1

A

-1

J

2

B

-2

K

3

C

-3

L

4

D

-4

M

5

E

-5

N

6

F

-6

O

7

G

-7

P

8

H

-8

Q

9

I

-9

R

Examples
Example 1: Processing a Number That Is Too Large To Format

When a numeric value is too large to format, as in this example

 data a;     x = 1e308;     y = put(x, ZD32.2);     put y = hex16.;  run; 

the result is a sequence of 39s:

 y=3939393939393939 
See Also
  • 'ZD w . d Informat' on page 420




SAS 9.1 Companion for Windows
SAS 9.1 Companion for Windows (2 Volumes)
ISBN: 1590472004
EAN: 2147483647
Year: 2004
Pages: 187

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net