Converting User-Written Informats from Earlier Releases to SAS 9.1


Converting User -Written Informats from Earlier Releases to SAS 9.1

You must convert Release 6.04, Release 6.06, and Release 6.08 user-written informats and formats to their SAS 9.1 counterparts before you can use them in a SAS 9.1 program. The only exception to this rule is user-written informats and formats created by Release 6.08 or later under Windows; these informats and formats can be read directly from your Windows SAS session. [*]

Converting Version 6 User-Written Informats

You can convert Release 6.04, 6.06, and 6.08 SAS catalogs that contain user-written informats and formats by using one of the following methods :

Converting Release 6.04 catalogs

  • use the CNTLOUT= option in the PROC FORMAT statement in Release 6.04 to create an output data set, and then use the CNTLIN= option in the PROC FORMAT statement in SAS 9.1 to create the SAS 9.1 informats or formats. You must use the V604 engine in your SAS 9.1 session to read the data set. This method also works for converting from Release 6.06 or Release 6.08.

Converting Release 6.06 or Release 6.08 catalogs

  • use the CPORT and CIMPORT procedures to convert the informats and formats. For more information about the CPORT and CIMPORT procedures, see Base SAS Procedures Guide . This method works for converting from Release 6.06 or Release 6.08 only; it does not work for converting from Release 6.04.

Converting Version 5 User-Written Informats

You must also convert Version 5 user-written informats and formats to their SAS 9.1 counterparts before you can use them in a SAS 9.1 program. (This implies that you are not only converting these files, but are also transferring them from a remote operating system to your PC). You can convert them using one of the following methods:

  • Use the V5TOV6 procedure on the remote operating environment to convert the informats and formats to Version 6 format. This implies that the remote operating environment has access to Version 6 SAS software. Then, transport the converted informats and formats (as binary files) to your Windows operating environment and use the CIMPORT procedure to complete the conversion.

    Note: The V5TOV6 procedure is not available in SAS 9.1. You must use this procedure in Release 6 of SAS.

  • Use the SUGI supplemental procedure FMTLIB under Version 5 on the remote operating environment to create an output data set, transport that data set to your PC, and then use the CNTLIN= option in the PROC FORMAT statement in SAS 9.1 to create the SAS 9.1 informats or formats.

HEXw. Informat

Converts hexadecimal positive binary values to fixed-point or floating-point binary values

Category numeric

Width range: 1-16

Default width: 8

Alignment: left

Windows specifics: native floating-point representation

See: HEXw. Informat in SAS Language Reference: Dictionary

Syntax

HEX w .

w

  • specifies whether the input represents an integer (fixed-point) or a real (floating-point) binary number. When you specify a w value of 1 through 15, the input hexadecimal value represents an integer binary number. When you specify 16 for the w value, the input hexadecimal value represents a floating-point value.

Details

The HEX w . informat expects input that is not byte- reversed , that is, not in Windows form. (The IB, PIB, and RB informats for binary numbers expect the bytes to be reversed.) This means that you can use the HEX w . informat to read hexadecimal literals from SAS programs that were created in another environment.

See Also
  • '$HEX w . Informat' on page 416

  • 'HEX w . Format' on page 376

$HEXw. Informat

Converts hexadecimal data to character data

Category character

Width range: 1-32767

Default width: 2

Alignment: left

Windows specifics: ASCII character-encoding system

See: $HEXw. Informat in SAS Language Reference: Dictionary

Syntax

$HEX w .

w

  • specifies width of the input value.

Details

The $HEX w . informat is like the HEX w . informat in that it reads values in which each hexadecimal digit occupies 1 byte. Use the $HEX w . informat to encode hexadecimal information into a character variable when your input data are limited to printable characters . The conversion is based on the ASCII character set.

See Also
  • 'HEX w . Informat' on page 415

  • '$HEX w . Format' on page 377

IBw.d Informat

Reads integer binary (fixed-point) data

Category numeric

Width range: 1-8

Default width: 4

Decimal range: 0-10

Windows specifics: native floating-point representation

See: IBw.d Informat in SAS Language Reference: Dictionary

Syntax

IB w . d

w

  • specifies the width of the input field.

d

  • optionally specifies the power of 10 by which to divide the input value. SAS uses the d value even if the input data contain decimal points.

Details

For integer binary data, the high-order bit is the value's sign: 0 for positive values, 1 for negative. Negative values are represented in twos -complement notation. If the informat includes a d value, the data value is divided by 10 d .

Using the IB w . d informat requires you to understand twos complements and byte-swapped data format.

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

Comparison of IB and PIB

The IB w . d informat and the PIB w . d informat give you different results. The IB w . d informat processes both positive and negative numbers and it uses the high-order bit as the sign bit. In contrast, the PIB w . d informat is used only for positive numbers and it does not look for a sign bit. As an example, suppose your data contain the following two-byte (byte-swapped) value:

 01 80 

When you read this value using the IB2. informat, the informat looks for the sign bit, sees that it is on, and reads the value as -32,767. However, if you read this value with the PIB2. informat, no sign bit is used, and the result is 32,769.

Example

Suppose that your data contain the following 6-byte (byte-swapped) value:

 64 00 00 00 00 00 

If you read this value using the IB6. informat, it is read as the fixed-point value 100.0. Now suppose that your data contain the following (byte-swapped) value:

 01 80 

Because the sign bit is set, the value is read as -32,767.

See Also
  • 'IB w . d Format' on page 377

  • 'Reading Binary Data' on page 413

PDw.d Informat

Reads packed decimal data

Category numeric

Width range: 1-16

Default width: 1

Decimal range: 0-31

Windows specifics: How values are interpreted as negative or positive

See: PDw.d Informat in SAS Language Reference: Dictionary

Syntax

PD w . d

w

  • specifies the width of the input field.

d

  • optionally specifies the power of 10 by which to divide the input value. If the data contain decimal points, then SAS ignores the d value.

Details

In packed decimal data, each byte contains two digits. The value's sign is in the first bit of the first byte (although the entire first byte is used for the sign). Although it is usually impossible to key in packed decimal data directly from a terminal, many programs write packed decimal data. The decimal range is 1 through 31.

Example

Suppose your data contain the following packed decimal number:

 80 00 11 43 

If you use the PD4. informat, this value is read as the double-precision value -1143.0. Similarly, the following value is read as 1500.0:

 00 00 15 00 
See Also
  • 'PD w . d Format' on page 379

  • 'Reading Binary Data' on page 413

PIBw.d Informat

Reads positive integer binary (fixed-point) data

Category numeric

Width range: 1-8

Default width: 1

Decimal range: 0-10

Windows specifics: native byte-swapped integers

See: PIBw.d Informat in SAS Language Reference: Dictionary

Syntax

PIB w . d

w

  • specifies the width of the input field.

d

  • optionally specifies the power of 10 by which to divide the input value. SAS uses the d value even if the input data contain decimal points.

Details

Positive integer binary values are the same as integer binary (see the informat 'IB w . d Informat' on page 416), except that all values are treated as positive. Thus, the high-order bit is part of the value rather than the value's sign.

Comparison of PIB and IB

The PIB w . d informat and the IB w . d informat give you different results, and you should differentiate carefully between these two informats. The IB w . d informat processes both positive and negative numbers and uses the high-order bit as the sign bit. In contrast, the PIB w . d informat is used only for positive numbers and it does not look for a sign bit. As an example, suppose your data contain the following two-byte (byte-swapped) value:

 01 80 

When you read this value using the IB2. informat, the informat looks for the sign bit, sees that it is on, and reads the value as -32,767. However, if you read this value with the PIB2. informat, no sign bit is used, and the result is 32,769.

Example

Suppose your data contain the following one-byte value:

 FF 

If you read this value using the PIB1. informat, it is read as the double-precision value 255.0. Using this informat requires you to understand twos complements and byte-swapped data format.

See Also
  • 'PIB w . d Format' on page 380

  • 'Reading Binary Data' on page 413

RBw.d Informat

Reads real binary (floating-point) data

Category numeric

Width range: 2-8

Default width: 4

Decimal range: 0-10

Windows specifics: native floating-point representation

See: RBw.d Informat in SAS Language Reference: Dictionary

Syntax

RB w . d

w

  • specifies the width of the input field.

d

  • optionally specifies the power of 10 by which to divide the input value. SAS uses the d value even if the input data contain decimal points.

Details

The RB w . d informat reads numeric data that are stored in microcomputer real binary (floating-point) notation. Numeric data for scientific calculations are often stored 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. It is usually impossible to key in floating-point binary data directly from a terminal, but many programs write floating-point binary data.

See Also
  • 'RB w . d Format' on page 381

  • 'Reading Binary Data' on page 413

ZDw.d Informat

Reads zoned decimal data

Category numeric

Width range: 1-32

Default width: 1

Decimal range: 1-10

Windows specifics: Last byte includes the sign

See: ZDw.d Informat in SAS Language Reference: Dictionary

Syntax

ZD w . d

w

  • specifies the width of the input field.

d

  • optionally specifies the power of 10 by which to divide the input value. If the data contain decimal points, then SAS ignores the d value.

Details

This is also known as an overprint trailing numeric format. Under Windows, 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

See Also
  • 'ZD w . d Format' on page 382

[*] However, it is recommended that you use PROC CPORT and PROC CIMPORT to convert older Windows catalogs that contain user-written informats and formats to SAS 9.1 if you no longer need to use them in previous releases.




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