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

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

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

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

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

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

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

CHAPTER 13 Importing and Exporting External Data

Using Cross-Environment Data Access (CEDA)

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr

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

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

Using Data Transfer Services

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

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

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

Graphics. Chapter Overview CHAPTER 4

Chapter 3 Managing Results in Projects. Chapter Table of Contents

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

Using SAS Files. Introduction CHAPTER 5

Storing and Reusing Macros

SAS Support for TELNET on Windows

SAS. IT Service Level Management 2.1: Migration Documentation

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

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

Chapter 2 User Interface Features. networks Window. Drawing Panel

OpenVMS Operating Environment

Chapter 6 Creating Reports. Chapter Table of Contents

DBLOAD Procedure Reference

Using the SQL Editor. Overview CHAPTER 11

CS & IT Conversions. Magnitude 10,000 1,

COMP2611: Computer Organization. Data Representation

SAS/ASSIST Software Setup

Chapter 7 File Access. Chapter Table of Contents

The TRANTAB Procedure

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

UNIT 7A Data Representation: Numbers and Text. Digital Data

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

unused unused unused unused unused unused

External Files. Definition CHAPTER 38

SYSTEM 2000 Essentials

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

15.4 Constrained Maxima and Minima

Alternative ODS HTML Statements for Running Examples in Different Operating Environments

The EXPLODE Procedure

COMP Overview of Tutorial #2

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.

Introduction to the OpenVMS Operating Environment

Optimizing System Performance

Number Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column

The GTESTIT Procedure

SAS File Management. Improving Performance CHAPTER 37

Routing the SAS Log and SAS Procedure Output

Examples That Use Remote Objecting

Chapter 4: Computer Codes. In this chapter you will learn about:

CHW 261: Logic Design

Creating and Executing Stored Compiled DATA Step Programs

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

SCL Arrays. Introduction. Declaring Arrays CHAPTER 4

Digital Fundamentals

Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example

Chapter 27 Saving and Printing Graphics

OS/2: SPX Access Method

Inf2C - Computer Systems Lecture 2 Data Representation

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

Numeric Variable Storage Pattern

Chapter 25 Editing Windows. Chapter Table of Contents


Licensing SAS DataFlux Products

Chapter 3 DATA REPRESENTATION

MACHINE LEVEL REPRESENTATION OF DATA

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM

Introduction to Computers and Programming. Numeric Values

Windows: SPX Access Method

OS/390 Platform Examples

QUEST Procedure Reference

Tasks Menu Reference. Introduction. Data Management APPENDIX 1

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

The STANDARD Procedure

Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur Number Representation

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

CHAPTER 7 Examples of Combining Compute Services and Data Transfer Services

Introduction. CHAPTER 3 Working in the SAS Windowing Environment

Chapter 2 Data Representations

The SERVER Procedure. Introduction. Syntax CHAPTER 8

SAS Workflow Manager 2.2: Administrator s Guide

Data Representations & Arithmetic Operations

Choosing the Right Procedure

BINARY SYSTEM. Binary system is used in digital systems because it is:

Chapter 13 Multivariate Techniques. Chapter Table of Contents

Chapter 14 Introduction to the FACTEX Procedure

SAS Data Integration Studio 3.3. User s Guide

Using Dynamic Data Exchange

The GREMOVE Procedure

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Loading Data. Introduction. Understanding the Volume Grid CHAPTER 2

Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:

SAS Web Infrastructure Kit 1.0. Overview

UNIX Platform Error Messages

Introduction to MDDBs

Transcription:

263 CHAPTER 13 Formats SAS Formats under OpenVMS 263 Writing Binary Data 263 SAS Formats under OpenVMS A SAS format is an instruction or template that the SAS System uses to rite data values. Most SAS formats are described completely in SAS Language Reference: Dictionary. The formats that are described here have behavior that is specific to the SAS System under OpenVMS. Many of the SAS formats that have details that are specific to the OpenVMS operating environment are used to rite binary data. For more information, see Writing Binary Data on page 263. Writing Binary Data Different computers store numeric binary data in different forms. IBM 370 and Helett-Packard 9000 computers store bytes in one order. Microcomputers that are IBM compatible and some computers manufactured by Digital Equipment Corporation store bytes in a different order called byte-reversed. Binary data that are stored in one order cannot be read by a computer that stores binary data in the other order. When you are designing SAS applications, try to anticipate ho your data ill be read and choose your formats and informats accordingly. The SAS System provides to sets of informats for reading binary data and corresponding formats for riting binary data. 3 The IB.d, PD.d, PIB.d, and RB.d informats and formats read and rite in native mode, that is, using the byte-ordering system that is standard for the machine. 3 The S370FIB.d, S370FPD.d, S370FRB.d, and S370FPIB.d informats and formats read and rite according to the IBM 370 standard, regardless of the native mode of the machine. These informats and formats allo you to rite SAS programs that can be run in any SAS environment, regardless of ho numeric data are stored. If a SAS program that reads and rites binary data runs on only one type of machine, you can use the native mode informats and formats. Hoever, if you ant to rite SAS programs that can be run on multiple machines using different byte-storage

264 HEX. 4 Chapter 13 systems, use the IBM 370 formats and informats. The purpose of the IBM 370 informats and formats is to enable you to rite SAS programs that can be run in any SAS environment, no matter hat standard you use for storing numeric data. For example, suppose you have a program that rites data ith the PIB.d format. You execute the program on a microcomputer so that the data are stored in byte-reversed mode. Then you run another SAS program on the microcomputer that uses the PIB.d informat to read the data. The data are read correctly because both of the programs are run on the microcomputer using byte-reversed mode. Hoever, you cannot upload the data to a Helett-Packard 9000-series machine and read the data correctly because they are stored in a form native to the microcomputer but foreign to the Helett-Packard 9000. To avoid this problem, use the S370FPIB.d format to rite the data; even on the microcomputer, this causes the data to be stored in IBM 370 mode. Then read the data using the S370FPIB.d informat. Regardless of hat type of machine you use hen reading the data, they are read correctly. HEX. Converts real-binary (floating-point) values to hexadecimal values Width range: 1to16 Default idth: 8 OpenVMS specifics: ASCII character-encoding system HEX. specifies the idth of the output field. When you specify a 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 value, the floating-point value of the number is used; in other ords, the number is not truncated. Details Each byte requires to columns to represent the corresponding hexadecimal digits. Under OpenVMS, the hexadecimal format of the number is stored in ASCII representation. For example, the decimal integer 17 has a hexadecimal value of 11, so the HEX2. format of 17 is 11. If HEX16. is specified, the floating-point number is not converted to an integer, and you receive the hexadecimal representation of the native floating-point representation. The bytes of the number are printed so that the left-most byte is of the loest significance. For more information about OpenVMS floating-point representation, see Architecture Reference Manual for Alpha and Architecture Reference Manual for VAX.

Formats 4 IB.d 265 3 Formats: HEX. insas Language Reference: Dictionary and $HEX. on page 265 3 Informat: HEX. on page 322 $HEX. Converts character values to hexadecimal values Category: character Width range: 1 to 32767 Default idth: 4 OpenVMS specifics: ASCII character-encoding system $HEX. specifies the idth of the output field. Details The $HEX. format is like the HEX. format in that it converts a character value to hexadecimal notation, ith each byte requiring to columns. Under OpenVMS, the $HEX. format produces hexadecimal representations of ASCII codes for characters. 3 Formats: $HEX. insas Language Reference: Dictionary and HEX. on page 264 3 Informat: $HEX. on page 323 IB.d Writes numbers in integer binary (fixed-point) format Width range: 1to8 Default idth: 4 Decimal range: 0to10

266 PD.d 4 Chapter 13 Alignment: left OpenVMS specifics: tos-complement notation; overflo behavior IB.d specifies the idth of the output field in bytes (not digits). d optionally specifies a scaling factor. When you specify a d value, the IB.d format multiplies the number by the 10 d value, then applies the integer binary format to that value. Details Negative values are stored in tos-complement notation. If a noninteger value is formatted, rounding occurs. If the value to be formatted is too large to fit in a field of the specified idth, then the IB.d format does the folloing: 3 for positive values, it sets the output to the largest positive number that fits in the given idth 3 for negative values, it sets the output to the negative number of greatest magnitude that fits in the given idth. For more information about OpenVMS native fixed-point values, see Architecture Reference Manual for Alpha and Architecture Reference Manual for VAX. Example If you format the value 300 using the IB1. format, you receive the folloing value: 127 hich is the largest positive value that fits in a byte. If you format the value -300 using the IB1. format, you receive the folloing value: -128 3 Format: IB.d in SAS Language Reference: Dictionary 3 Informat: IB.d on page 323 3 Writing Binary Data on page 263 PD.d Writes values in packed decimal format

Formats 4 PIB.d 267 Width range: 1to16 Default idth: 1 Decimal range: 0to10 OpenVMS specifics: overflo behavior PD.d specifies the idth of the output field in bytes (not digits). d optionally specifies a scaling factor. When you specify a d value, the PD.d format multiplies the number by the 10 d value, then applies the packed decimal format to that value. Details Under OpenVMS, if the value to be formatted is too large to fit in a field of the specified idth, then the PD.d format does the folloing: 3 for positive values, it sets the output to the largest positive number that fits in the given idth 3 for negative values, it sets the output to the negative number of greatest magnitude that fits in the given idth. Example If you format the value 300 using the PD1. format, you receive the folloing hexadecimal string: 9C x hich is the packed decimal representation for 9. If you format the value -300 using the PD1. format, you receive the folloing hexadecimal string: 9D x hich is the packed decimal representation for -9. 3 Format: PD.d in SAS Language Reference: Dictionary 3 Informat: PD.d on page 324 3 Writing Binary Data on page 263 PIB.d Writes positive integer-binary fixed-point values

268 RB.d 4 Chapter 13 Width range: 1to8 Default idth: 1 Decimal range: 0to10 OpenVMS specifics: overflo behavior PIB.d specifies the idth of the output field in bytes (not digits). d optionally specifies a scaling factor. When you specify a d value, the PIB.d format multiplies the number by the 10 d value, then applies the positive integer binary format to that value. Details If the value to be formatted is too large to fit in a field of the specified idth, then this format does the folloing: 3 for positive values, it sets the output to the largest positive number that fits in the given idth 3 for negative values, it sets the output to the negative number of greatest magnitude that fits in the given idth. If a noninteger value is formatted, rounding occurs. For more information about OpenVMS native fixed-point values, see Architecture Reference Manual for Alpha and Architecture Reference Manual for VAX. Example If you format the value 300 ith the PIB1. format, you receive the folloing value: 255 hich is the largest unsigned value that fits in a 1-byte field. 3 Format: PIB.d in SAS Language Reference: Dictionary 3 Informat: PIB.d on page 325 3 Writing Binary Data on page 263 RB.d Writes numeric data in real-binary (floating-point) notation

Formats 4 UIC. 269 Width range: 2to8 Default idth: 4 Decimal range: 0to10 OpenVMS specifics: native floating-point representation RB.d specifies the idth of the output field. d optionally specifies a scaling factor. When you specify a d value, the RB.d format multiplies the number by the 10 d value, then applies the real binary format to that value. Details Under OpenVMS, the RB.d format causes floating-point numbers to be formatted in the native floating-point representation. Numeric data for scientific calculations are commonly represented in floating-point notation. (The SAS System stores all numeric values in floating-point notation.) A floating-point value consists of to 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 the SAS System already represents numbers this ay and no conversion is needed. For more information about OpenVMS floating-point representation, see Architecture Reference Manual for Alpha and Architecture Reference Manual for VAX. 3 Format: RB.d in SAS Language Reference: Dictionary 3 Informat: RB.d on page 326 3 Writing Binary Data on page 263 UIC. Converts a SAS numeric value to an OpenVMS UIC string Width range: 16 to 31 Default idth: 31

270 VMSMSG. 4 Chapter 13 OpenVMS specifics: All aspects are host-specific UIC. is the idth of the output field and must be 16 through 31 (numbers less than 16 or greater than 31 are invalid). If no value is specified, then UIC defaults to the idth of the resulting output string. Details The UIC value is a 32-bit value, here the upper 16 bits is the group value and the loer 16 bits is the member value. The UIC values that are displayed as to numbers are octal numbers. If alphanumeric values exist for the numbers, the alphanumerics ill be displayed. For example: data_null_; x=4194377; put x uic.; run; produces [HOSTVAX,MYIDENT] A system manager assigns a user identification code (UIC) to each OpenVMS user and stores the UIC in the user authorization file (UAF). Each UIC consists of a member identifier and (optionally) a group identifier, enclosed in square brackets, as follos: [<group-identifier,>member-identifier] here member-identifier and group-identifier can be either names, numbers, or hexadecimal representations. 3 Function: GETQUOTA on page 298 VMSMSG. Writes numeric values as character strings that contain the equivalent OpenVMS message Width range: 16 to 200, here is 16 to 20 OpenVMS specifics: All aspects are host-specific VMSMSG.

Formats 4 VMSZN.d 271 specifies the idth of the output field. Details Data formatted using the VMSMSG. format are ASCII strings. Symbolic FAO (Formatted ASCII Output) substitution is not performed. Example If you format the value 1 using the VMSMSG. format in the folloing SAS statement: put rc vmsmsg.; the result is %SYSTEM-S-NORMAL, hich is an ASCII string indicating normal successful completion. VMSTIMEF. Converts a SAS date-time value to an 8-byte binary value in OpenVMS date and time format Category: date and time Width range: 8 Default idth: 8 OpenVMS specifics: All aspects are host-specific VMSTIMEF. Details The VMSTIMEF. format is specific to OpenVMS. You cannot specify a idth ith this format; the idth is alays 8 bytes. OpenVMS date and time values that are read in ith the VMSTIME. informat retain precision up to 1/100 of a second, even though the SAS System cannot display anything less than hole seconds. If you later use the VMSTIMEF. format to rite out the date-time value, the precision is retained. 3 Informat: VMSTIME. on page 328 VMSZN.d Generates a string of ASCII digits

272 VMSZN.d 4 Chapter 13 Width range: 1to32 Default idth: 1 OpenVMS specifics: All aspects are host-specific VMSZN.d specifies the idth of the output field d optionally specifies the number of digits to the right of the decimal point in the numeric value. Details The VMSZN.d format is similar to the ZD.d format. Both generate a string of ASCII digits, and the last digit is a special character that denotes the magnitude of the last digit and the sign of the entire number. The difference beteen these formats is in the special character that is used for the last digit. The folloing table shos the special characters that are used by the VMSZN.d format. Desired Special Desired Special Digit Character Digit Character 0 0 0 p 1 1-1 q 2 2-2 r 3 3-3 s 4 4-4 t 5 5-5 u 6 6-6 v 7 7-7 8 8-8 x 9 9-9 y Data formatted using the VMSZN.d format are ASCII strings. If the value to be formatted is too large to fit in a field of the specified idth, then the VMSZN.d format does the folloing: 3 for positive values, it sets the output to the largest positive number that fits in the given idth 3 for negative values, it sets the output to the negative number of greatest magnitude that fits in the given idth.

Formats 4 VMSZN.d 273 Examples Example 1: Using the VMSZN.d Format in a SAS Statement If you format the value 1234 using the VMSZN.d format in the folloing SAS statement: put i vmszn4.; the result is 1234, hich is an ASCII string. If you format the value 1234 using the VMSZN.d format in the folloing SAS statement: put i vmszn5.1; the result is 12340, hich is an ASCII string. If you format the value 1234 using the VMSZN.d format in the folloing SAS statement: put i vmszn6.2; the result is 123400, hich is an ASCII string. If you format the value -1234 using the VMSZN.d format in the folloing SAS statement: put i vmszn5.; the result is 123t, hich is an ASCII string. Example 2: Zoned-Numeric Representations If you format the value 300 using the VMSZN.d format, you receive the folloing value: 9 hich is an ASCII string. If you format the value -300 using the VMSZN.d format, you receive the folloing value: y hich is an ASCII string that is the zoned-numeric representation of -9. 3 Format: ZD.d in SAS Language Reference: Dictionary 3 Informats: VMSZN.d on page 328 and ZD.d on page 330

274 VMSZN.d 4 Chapter 13

The correct bibliographic citation for this manual is as follos: SAS Institute Inc., SAS Companion for the OpenVMS Environment, Version 8, Cary, NC: SAS Institute Inc., 1999. 518 pp. SAS Companion for the OpenVMS Environment, Version 8 Copyright 1999 by SAS Institute Inc., Cary, NC, USA. 1 58025 526 4 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, by any form or by any means, electronic, mechanical, photocopying, or otherise, ithout the prior ritten permission of the publisher, SAS Institute Inc. U.S. Government Restricted Rights Notice. Use, duplication, or disclosure of the softare by the government is subject to restrictions as set forth in FAR 52.227 19 Commercial Computer Softare-Restricted Rights (June 1987). 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 softare and related services. SAS Institute Inc., SAS Campus Drive, Cary, North Carolina 27513.