Informats. Informats Under UNIX. HEXw. informat. $HEXw. informat. Details CHAPTER 13

Similar documents
Formats. Formats Under UNIX. HEXw. format. $HEXw. format. Details CHAPTER 11

Informats. SAS Informats under OpenVMS. Reading Binary Data CHAPTER 15

Data Representation. Variable Precision and Storage Information. Numeric Variables in the Alpha Environment CHAPTER 9

Formats. SAS Formats under OS/2. Writing Binary Data CHAPTER 13

Formats. SAS Formats under OpenVMS. Writing Binary Data CHAPTER 13

Chapter 7 File Access. Chapter Table of Contents

Chapter 28 Saving and Printing Tables. Chapter Table of Contents SAVING AND PRINTING TABLES AS OUTPUT OBJECTS OUTPUT OBJECTS...

APPENDIX 2 Customizing SAS/ASSIST Software

Using Cross-Environment Data Access (CEDA)

Informats. Informats in the CMS Environment. Considerations for Using Informats under CMS. EBCDIC and Character Data CHAPTER 15

Permission Program. Support for Version 6 Only. Allowing SAS/SHARE Client Access to SAS Libraries or Files CHAPTER 40

Introduction. LOCK Statement. CHAPTER 11 The LOCK Statement and the LOCK Command

Macro Facility. About the Macro Facility. Automatic Macro Variables CHAPTER 14

CHAPTER 13 Importing and Exporting External Data

Graphics. Chapter Overview CHAPTER 4

Chapter 25 PROC PARETO Statement. Chapter Table of Contents. OVERVIEW SYNTAX SummaryofOptions DictionaryofOptions...

Chapter 3 Managing Results in Projects. Chapter Table of Contents

Creating and Executing Stored Compiled DATA Step Programs

SYSTEM 2000 Essentials

Using Data Transfer Services

from the source host, use the FTP put command to copy a file from the source host to the target host.

DBLOAD Procedure Reference

Storing and Reusing Macros

SAS/ASSIST Software Setup

Chapter 23 Animating Graphs. Chapter Table of Contents ANIMATING SELECTION OF OBSERVATIONS ANIMATING SELECTED GRAPHS...347

Chapter 6 Creating Reports. Chapter Table of Contents

Alternative ODS HTML Statements for Running Examples in Different Operating Environments

SAS File Management. Improving Performance CHAPTER 37

The EXPLODE Procedure

Using the SQL Editor. Overview CHAPTER 11

External Files. Definition CHAPTER 38

Data Set Options. Specify a data set option in parentheses after a SAS data set name. To specify several data set options, separate them with spaces.

SAS I/O Engines. Definition. Specifying a Different Engine. How Engines Work with SAS Files CHAPTER 36

SAS Catalogs. Definition. Catalog Names. Parts of a Catalog Name CHAPTER 32

Using Dynamic Data Exchange

The TRANTAB Procedure

Chapter 27 Saving and Printing Graphics

OpenVMS Operating Environment

Chapter 2 User Interface Features. networks Window. Drawing Panel

QUEST Procedure Reference

CHAPTER 7 Using Other SAS Software Products

SAS Support for TELNET on Windows

Optimizing System Performance

The GTESTIT Procedure

Routing the SAS Log and SAS Procedure Output

SAS Data Libraries. Definition CHAPTER 26

The correct bibliographic citation for this manual is as follows: SAS Institute Inc Proc EXPLODE. Cary, NC: SAS Institute Inc.

SAS. IT Service Level Management 2.1: Migration Documentation

Overview. CHAPTER 2 Using the SAS System and SAS/ ASSIST Software

Licensing SAS DataFlux Products

UNIX Platform Error Messages

Examples That Use Remote Objecting

APPENDIX 4 Migrating from QMF to SAS/ ASSIST Software. Each of these steps can be executed independently.

Windows: SPX Access Method

SCL Arrays. Introduction. Declaring Arrays CHAPTER 4

OS/2: SPX Access Method

Tasks Menu Reference. Introduction. Data Management APPENDIX 1

Chapter 25 Editing Windows. Chapter Table of Contents

Handling Exceptions. Introduction. Using the Program Halt Handler CHAPTER 10

SAS Web Infrastructure Kit 1.0. Overview

The SERVER Procedure. Introduction. Syntax CHAPTER 8

Defining Your Data Sources

Chapter 13 Multivariate Techniques. Chapter Table of Contents

Using SAS Files. Introduction CHAPTER 5

OS/390 Platform Examples

Chapter 14 Introduction to the FACTEX Procedure

Changes and Enhancements

SAS Workflow Manager 2.2: Administrator s Guide

Using Unnamed and Named Pipes

CV2ODBC Procedure. Overview. CV2ODBC Procedure Syntax APPENDIX 4

The GSLIDE Procedure. Overview. About Text Slides CHAPTER 27

UNIX Spawner Program. Starting the UNIX Spawner Program CHAPTER 36

The STANDARD Procedure

SAS/ACCESS Data Set Options

Choosing the Right Procedure

SAS Clinical Data Integration 2.4

Installation Instructions for SAS/ACCESS Interface to SAP BW

The FORMS Procedure. Overview CHAPTER 20

Introduction to MDDBs

Introduction. Understanding SAS/ACCESS Descriptor Files. CHAPTER 3 Defining SAS/ACCESS Descriptor Files

The TIMEPLOT Procedure

Chapter 9 Selected Examples. Queues with Reneging

Locking SAS Data Objects

What Is a Communications Access Method? CHAPTER 1 Using Communications Access Methods

The G4GRID Procedure. Introduction APPENDIX 1

DATA Step Debugger APPENDIX 3

Customizing Your SAS Session

CHAPTER 5 Macintosh: TCP/IP Access Method

Introduction. Getting Started with the Macro Facility CHAPTER 1

Using CVS Repositories with SAS

Routing Output. Producing Output with SAS Software CHAPTER 6

Enterprise Miner Software: Changes and Enhancements, Release 4.1

Using the SAS/ACCESS Interface to IMS-DL/I DATA Step Interface

Introduction. CHAPTER 3 Working in the SAS Windowing Environment

SAS Forecast Server 3.1. Administrator s Guide to Installation and Configuration

Batch Importing. Overview CHAPTER 4

Chapter 28 Command Reference. Chapter Table of Contents TSVIEW COMMAND FORECAST COMMAND

CHAPTER 7 Examples of Combining Compute Services and Data Transfer Services

CREATING THE DISTRIBUTION ANALYSIS

Administering SAS Enterprise Guide 4.2

Transcription:

207 CHAPTER 13 Informats Informats Under UNIX 207 Informats Under UNIX This chapter describes SAS informats that have behavior or syntax this is specific to UNIX environments. Each informat description includes a brief UNIX specifics section that tells which aspect of the informat is specific to UNIX. All of these informats are described in both this documentation and in SAS Language Reference: Dictionary. HEXw. informat Converts hexadecimal positive binary values to fixed- or floating-point binary Width range: 1to16 Default width: 8 UNIX specifics: floating-point representation The HEXw. informat converts the hexadecimal representation of positive binary numbers to real floating-point binary values. The width value of the HEXw. informat determines whether the input represents an integer (fixed-point) or real (floating-point) binary number. When you specify a width of 1 through 15, the informat interprets the input hexadecimal as an integer binary number. When your specify 16 for the with value, the informat interprets the input hexadecimal as a floating-point value. $HEXw. informat Converts hexadecimal data to character data Character

208 IBw.d informat 4 Chapter 13 Width range: 1 to 32767 Default width: 2 UNIX specifics: values are interpreted as ASCII values The $HEXw. informat converts every two digits of hexadecimal data into one byte of character data. Use the $HEXw. informat to encode hexadecimal values into a character variable when your input data is limited to printable characters. The SAS System under UNIX interprets values that are read with this informat as ASCII values. IBw.d informat Reads integer binary (fixed-point) values Width range: 1to8 Default width: 4 Decimal range: 0to10 UNIX specifics: byte values The IBw.d informat reads fixed-point binary values. 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 two s-complement notation. If the informat includes a d value, the data value is divided by 10 d. PDw.d informat Reads packed decimal data Width range: 1to16 Default width: 1 Decimal range: 0to31 UNIX specifics: data representation The PDw.d informat reads packed decimal data. Although it is usually impossible to type in packed decimal data directly from a console, many programs write packed decimal data.

Informats 4 RBw.d informat 209 Each byte contains two digits in packed decimal data. The value s sign is the first byte. Because the entire first byte is used for the sign, you should specify at least a width of 2. PIBw.d informat Reads positive integer binary (fixed-point) values Width range: 1to8 Default width: 1 Decimal range: 0to10 UNIX specifics: byte order The PIBw.d informat reads integer binary (fixed-point) values. Positive integer binary values are the same as integer binary (see IBw.d informat on page 208), except that all values are treated as positive. Thus, the high-order bit is part of the value rather than the value s sign. If the informat includes a d value, the data value is divided by 10 d. RBw.d informat Reads real binary (floating-point) data Width range: 2to8 Default width: 4 Decimal range: 0to10 UNIX specifics: floating-point representation; supports single-precision numbers only for those applications that truncate numeric data The RBw.d informat reads numeric data that are stored in real binary (floating-point) notation. The SAS System stores all numeric values in floating-point. It is usually impossible to type in floating-point binary data directly from a console, but many programs write floating-point binary data. Use caution if you are using the RBw.d informat to read floating-point data created by programs other than the SAS System because the RBw.d informat is designed to read only double-precision data. All UNIX systems that are currently supported by the SAS System use the IEEE standard for floating-point representation. This representation supports both single-precision and double-precision floating-point numbers. Double-precision

210 RBw.d informat 4 Chapter 13 representation has more bytes of precision, and the data within the representation is interpreted differently. For example, for single-precision, the value of 1 in hexadecimal representation is 3F800000. For double-precision, the hexadecimal representation of 1 is 3FF0000000000000. The RBw.d informat is designed to read only double-precision data. It supports widths less than 8 only for applications that truncate numeric data for space-saving purposes. RB4. does not expect a single-precision floating-point number; it expects a double-precision number truncated to four bytes. Using the example of 1 above, RB4. expects 3FF00000 to be the hexadecimal representation of the four bytes of data to be interpreted as 1. If given 3F800000, the single-precision value of 1, a different number results. External programs such as those written in C and FORTRAN can only produce single- or double-precision floating-point numbers. No length other than four or eight bytes is allowed. RBw.d allows a length of 3 through 8, depending on the storage you need to save. The FLOAT4. informat has been created to read a single-precision floating-point number. If you read 3F800000 with FLOAT4., the result is a value of 1. To read data created by a C or FORTRAN program, you need to decide on the proper informat to use. If the floating-point numbers require an eight-byte width, you should use the RB8. informat. If the floating point numbers require a four-byte width, you should use FLOAT4. Consider this C example: #include <stdio.h> main() { FILE *fp; float x[3]; fp = fopen("test.dat","wb"); x[0] = 1; x[1] = 2; x[2] = 3; fwrite((char *)x,sizeof(float),3,fp); fclose(fp); } The file test.dat contains 3f8000004000000040400000 in hexadecimal representation. The following statements read test.dat correctly: data _null_; infile test.dat ; input (x y z) (float4.); run; Also available is the IEEEw.d informat, which reads IEEE floating-point data. On UNIX systems, IEEE8. is equivalent to RB8., and IEEE4. is equivalent to FLOAT4. IEEEw.d can be used on any platform, as long as the original IEEE binary data originated on a platform that uses the IEEE representation.

Informats 4 ZDw.d informat 211 ZDw.d informat Reads zoned decimal data Width range: 1to32 Default width: 1 UNIX specifics: last byte includes the sign; data representation The ZDw.d informat reads zoned decimal data; it is also known as overprint trailing numeric format. Under UNIX, the last byte of the field includes the sign along with the last digit. The conversion table for the last byte is as follows: Digit ASCII Character Digit ASCII Character 0 { -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 For more details, see ZDw.d format on page 196 and Reading and Writing Binary Data on page 159.

212 ZDw.d informat 4 Chapter 13

The correct bibliographic citation for this manual is as follows: SAS Institute Inc., SAS Companion for UNIX Environments, Version 8, Cary, NC: SAS Institute Inc., 1999. SAS Companion for UNIX Environments, Version 8 Copyright 1999 by SAS Institute Inc., Cary, NC, USA. ISBN 1 58025 502 7 All rights reserved. Printed in the United States of America. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, or otherwise, without the prior written permission of the publisher, SAS Institute Inc. U.S. Government Restricted Rights Notice. Use, duplication, or disclosure of the software by the government is subject to restrictions as set forth in FAR 52.227 19 Commercial Computer Software-Restricted Rights (June 1987). SAS Institute Inc., SAS Campus Drive, Cary, North Carolina 27513. 1st printing, October 1999 SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. indicates USA registration. Other brand and product names are registered trademarks or trademarks of their respective companies. The Institute is a private company devoted to the support and further development of its software and related services.