Sas Documentation
Sas Documentation
Sas Documentation
SAS® Documentation
September 8, 2022
The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2016. SAS® 9.4 Formats and Informats: Reference. Cary,
NC: SAS Institute Inc.
SAS® 9.4 Formats and Informats: Reference
Copyright © 2016, SAS Institute Inc., Cary, NC, USA
n style conventions
n special characters
Syntax Components
The components of the syntax for most language elements include a keyword and
arguments. For some language elements, only a keyword is necessary. For other
language elements, the keyword is followed by an equal sign (=). The syntax for
arguments has multiple forms in order to demonstrate the syntax of multiple
arguments, with and without punctuation.
keyword
specifies the name of the SAS language element that you use when you write
your program. Keyword is a literal that is usually the first word in the syntax. In a
CALL routine, the first two words are keywords.
In these examples of SAS syntax, the keywords are bold:
CHAR (string, position)
CALL RANBIN (seed, n, p, x);
ALTER (alter-password)
BEST w.
vi Syntax Conventions for the SAS Language
REMOVE <data-set-name>
In this example, the first two words of the CALL routine are the keywords:
CALL RANBIN(seed, n, p, x)
The syntax of some SAS statements consists of a single keyword without
arguments:
DO;
... SAS code ...
END;
Some system options require that one of two keyword values be specified:
DUPLEX | NODUPLEX
Some procedure statements have multiple keywords throughout the statement
syntax:
CREATE <UNIQUE> INDEX index-name ON table-name (column-1 <,
column-2, …>)
argument
specifies a numeric or character constant, variable, or expression. Arguments
follow the keyword or an equal sign after the keyword. The arguments are used
by SAS to process the language element. Arguments can be required or
optional. In the syntax, optional arguments are enclosed in angle brackets ( <
> ).
In this example, string and position follow the keyword CHAR. These arguments
are required arguments for the CHAR function:
CHAR (string, position)
Each argument has a value. In this example of SAS code, the argument string
has a value of 'summer', and the argument position has a value of 4:
x=char('summer', 4);
In this example, string and substring are required arguments, whereas modifiers
and startpos are optional.
FIND(string, substring <, modifiers> <, startpos>
argument(s)
specifies that one argument is required and that multiple arguments are allowed.
Separate arguments with a space. Punctuation, such as a comma ( , ) is not
required between arguments.
The MISSING statement is an example of this form of multiple arguments:
MISSING character(s);
<LITERAL_ARGUMENT> argument-1 <<LITERAL_ARGUMENT> argument-2 ... >
specifies that one argument is required and that a literal argument can be
associated with the argument. You can specify multiple literals and argument
pairs. No punctuation is required between the literal and argument pairs. The
ellipsis (...) indicates that additional literals and arguments are allowed.
The BY statement is an example of this argument:
BY <DESCENDING> variable-1 <<DESCENDING> variable-2 …>;
Style Conventions vii
Style Conventions
The style conventions that are used in documenting SAS syntax include uppercase
bold, uppercase, and italic:
UPPERCASE BOLD
identifies SAS keywords such as the names of functions or statements. In this
example, the keyword ERROR is written in uppercase bold:
ERROR <message>;
UPPERCASE
identifies arguments that are literals.
In this example of the CMPMODEL= system option, the literals include BOTH,
CATALOG, and XML:
viii Syntax Conventions for the SAS Language
Special Characters
The syntax of SAS language elements can contain the following special characters:
=
an equal sign identifies a value for a literal in some language elements such as
system options.
In this example of the MAPS system option, the equal sign sets the value of
MAPS:
MAPS=location-of-maps
<>
angle brackets identify optional arguments. A required argument is not enclosed
in angle brackets.
In this example of the CAT function, at least one item is required:
CAT (item-1 <, item-2, …>)
|
a vertical bar indicates that you can choose one value from a group of values.
Values that are separated by the vertical bar are mutually exclusive.
In this example of the CMPMODEL= system option, you can choose only one of
the arguments:
CMPMODEL=BOTH | CATALOG | XML
...
an ellipsis indicates that the argument can be repeated. If an argument and the
ellipsis are enclosed in angle brackets, then the argument is optional. The
repeated argument must contain punctuation if it appears before or after the
argument.
In this example of the CAT function, multiple item arguments are allowed, and
they must be separated by a comma:
CAT (item-1 <, item-2, …>)
References to SAS Libraries and External Files ix
'value' or "value"
indicates that an argument that is enclosed in single or double quotation marks
must have a value that is also enclosed in single or double quotation marks.
In this example of the FOOTNOTE statement, the argument text is enclosed in
quotation marks:
FOOTNOTE <n> <ods-format-options 'text' | "text">;
;
a semicolon indicates the end of a statement or CALL routine.
In this example, each statement ends with a semicolon:
data namegame;
length color name $8;
color = 'black';
name = 'jack';
game = trim(color) || name;
run;
Overview
SAS Viya 3.4 adds the $UUID format and informat.
New formats write date, time, and datetime values based on user local time.
Some format values might differ slightly when the DECIMALCONV= system option
is set to STDIEEE.
E8601LXw.
writes datetime values as local time by appending a time zone offset difference
between the local time and UTC, using the ISO 8601 extended notation yyyy-
mm-ddThh:mm:ss+|–hh:mm.
E8601TXw.
adjusts a Coordinated Universal Time (UTC) value to the user local time. Then,
writes the local time by using the ISO 8601 extended time notation hh:mm:ss+|–
hh:mm.
ODDSRw.
writes odds ratios.
Enhancements to Formats
In 9.4m7, the F format is added to the documentation. This format is an alias for the
W format.
New Informats
SAS Viya 3.4 has added the $UUIDw. informat.
$UUIDw.
converts hexadecimal data to a 16-byte binary variable Universally Unique
Identifier (UUID).
PART 1
SAS Formats
Chapter 1
About Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Chapter 2
Dictionary of Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
2
3
1
About Formats
Definition of Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Using Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Ways to Specify Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Permanent versus Temporary Association . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
User-Defined Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Definitions for Dates, Times, and Intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Julian Date Formats and Astronomical Dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Two-Digit and Four-Digit Years . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Five-Digit Years . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
The Year 2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Working with SAS Dates and Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
About Date and Time Intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Intervals by Category . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Example: Calculating a Duration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Boundaries of Intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Single-Unit Intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Multi-unit Intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Shifted Intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Custom Intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Retail Calendar Intervals: ISO 8601 Compliant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Byte Ordering for Integer Binary Data on Big Endian and Little
Endian Platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
How Bytes Are Ordered Differently . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Writing Data Generated on Big Endian and Little Endian Platforms . . . . . . . . . . . . . . 37
Integer Binary Notation and Different Programming Languages . . . . . . . . . . . . . . . . . . 38
Data Conversions and Encodings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Working with Packed Decimal and Zoned Decimal Data . . . . . . . . . . . . . . . . . . . . . . . . . 40
Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4 Chapter 1 / About Formats
Types of Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Platforms That Support Packed Decimal and Zoned Decimal Data . . . . . . . . . . . . . . . 41
Languages That Support Packed Decimal and Zoned Decimal Data . . . . . . . . . . . . . 42
Summary of Packed Decimal and Zoned Decimal Formats and Informats . . . . . . . . 43
Working with Dates and Times by Using the ISO 8601 Basic and
Extended Notations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
ISO 8601 Formatting Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
About Dates and Times That Use the ISO 8601 Basic and Extended Notations . . . 47
Basic ISO 8601 Date, Time, and Datetime Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Extended ISO 8601 Date, Time, and Datetime Values . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Tips for Remembering UTC Formats That Use Time Zone Offsets . . . . . . . . . . . . . . . 50
Examples of Reading and Writing Basic and Extended ISO 8601
Date, Time, and Datetime Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Writing ISO 8601 Duration, Datetime, and Interval Values . . . . . . . . . . . . . . . . . . . . . . . 58
Definition of Formats
A format is a type of SAS language element that applies a pattern to or executes
instructions for a data value to be displayed or written as output. Types of formats
correspond to the type of data: numeric, character, date, time, or timestamp. The
ability to create user-defined formats is also supported. Examples of SAS formats
are BINARY, DATE, and WORDS. The WORDS22. format, which converts numeric
values to their equivalent in words, writes the numeric value 692 as six hundred
ninety-two.
Syntax
SAS formats have the following form:
<$>format<w>.<d>
$
indicates a character format. Its absence indicates a numeric format.
format
names the format. The format is a SAS format or a user-defined format that was
previously defined with the VALUE statement in PROC FORMAT.
w
specifies the format width, which for most formats is the number of columns in
the output data.
d
specifies an optional decimal scaling factor in the numeric formats.
Using Formats 5
Formats contain a period (.) as a part of the name. If you omit the w and d values
from the format, SAS uses default values. The d value that you specify with a format
tells SAS to display that many decimal places. Formats never change or truncate
the internally stored data values.
For example, in DOLLAR10.2, the w value of 10 specifies a maximum of 10
columns for the value. The d value of 2 specifies that two of these columns are for
the decimal part of the value, which leaves eight columns for the remaining
characters in the value. The remaining columns include the decimal point, the
remaining numeric value, a minus sign if the value is negative, the dollar sign, and
any commas.
If the format width is too narrow to represent a value, SAS tries to squeeze the value
into the space available. Character formats truncate values on the right. Numeric
formats sometimes revert to the BESTw.d format. SAS prints asterisks if you do not
specify an adequate width. In this example, the result is x=**:
x=123;
put x= 2.;
Using Formats
PUT Statement
The PUT statement with a format after the variable name uses a format to write data
values in a DATA step. For example, this PUT statement uses the DOLLARw.d
format to write the numeric value for AMOUNT as a dollar amount:
amount=1145.32;
put amount dollar10.2;
For more information, see “PUT Statement” in SAS DATA Step Statements:
Reference.
PUT Function
The PUT function converts a numeric variable, a character variable, or a constant by
using any valid format, and then returns the resulting character value. For example,
this statement converts the value of a numeric variable to a two-character
hexadecimal representation:
num=15;
char=put(num,hex2.);
The PUT function returns a value of 0F, which is assigned to the variable CHAR.
The PUT function is useful for converting a numeric value to a character value.
For more information, see “PUT Function” in SAS Functions and CALL Routines:
Reference.
%tst (1154.23);
FORMAT Statement
The FORMAT statement permanently associates character variables with character
formats and numeric variables with numeric formats.
SAS uses the format to write the values of the variable that you specify. For
example, the following statement in a DATA step associates the COMMAw.d
numeric format with the variables SALES1 through SALES3:
format sales1-sales3 comma10.2;
Note: If you assign formats with a FORMAT statement before a PUT statement, all
leading blanks are trimmed. Formats that are associated with variables that use a
FORMAT statement behave like formats that are used with a colon (:) modifier in a
subsequent PUT statement. For more information about using the colon format
modifier, see “PUT Statement: List” in SAS DATA Step Statements: Reference.
ATTRIB Statement
The ATTRIB statement can also associate a format, as well as other attributes, with
one or more variables. In this statement, the ATTRIB statement permanently
associates the COMMAw.d format with the variables SALES1 through SALES3:
attrib sales1-sales3 format=comma10.2;
User-Defined Formats
In addition to the formats that are supplied with Base SAS software, you can use
PROC FORMAT to create your own formats. PROC FORMAT enables you to create
your own formats for both character and numeric variables.
Note: PROC FORMAT is valid on the SAS client and the CAS server.
For more information, see “FORMAT Procedure” in Base SAS Procedures Guide
and SAS Cloud Analytic Services: User-Defined Formats.
User-defined format names cannot end in a number. If you specify a user-defined
format whose name ends in a number, SAS returns an error. You can re–create the
format with a valid name that does not end in a number, or you can use PROC
CATALOG to rename the format. Here is an example that uses PROC CATALOG to
change the name of a user-defined format from MYFMT22 to MYFMT.
proc catalog cat=work.formats;
change myfmt22=myfmt / entrytype = format;
quit;
Note: A SAS user or a third party’s software might create a format with a name that
ends in a number. Follow the guidelines for naming SAS elements at “Words and
Names” in SAS Programmer’s Guide: Essentials when you create user-defined
formats.
When you execute a SAS program on the SAS client that uses user-defined
formats, you can make these formats available in two ways:
n Create permanent, not temporary, formats with PROC FORMAT.
n Store the source code that creates the formats (the PROC FORMAT step) with
the SAS program that uses them.
To create permanent SAS formats, see “FORMAT Procedure” in Base SAS
Procedures Guide.
Your CAS administrator can configure the server so that format libraries are added
and promoted from libraries that are persisted as SASHDAT files in a caslib's data
source. The format libraries that you have created are not automatically loaded
when you start a CAS session, even if you have persisted them.
When you execute a SAS program in a CAS session that uses user-defined
formats, you can make these formats available in three ways:
n Use the addFmtLib action to add a format library that has been created with
PROC FORMAT.
Definitions for Dates, Times, and Intervals 9
n Use the SAVEFMTLIB option of the CAS statement to save a format library to a
CAS table or a SASHDAT. The table and the file include the formats in a format
library.
n Use the LOADFORMATS option of the CAS statement to load user-defined
formats from a format item-store file that was created with PROC FMTC2ITM.
For more information, see addFmtLib Action and CAS Statement.
If you execute a program that cannot locate a user-defined format, the result
depends on the setting of the FMTERR system option. If the user-defined format is
not found, these system options produce these results:
Although using NOFMTERR enables SAS to process a variable, you lose the
information that the user-defined format supplies.
To avoid problems, ensure that your program has access to all user-defined formats
that are used.
Definitions
SAS date value
is a value that represents the number of days between January 1, 1960, and a
specified date. SAS can perform calculations on dates that range from A.D.
November 1582 to A.D. 19,900. Dates before January 1, 1960, are negative
numbers; dates after January 1, 1960, are positive numbers.
n SAS date values account for all leap year days, including the leap year day in
the year 2000.
CAUTION
Using century dates greater than 4000 might result in incorrect dates.
SAS does not consider century years that are divisible by 4000 to be leap years.
Computations on dates that use a century date greater than or equal to 4000
10 Chapter 1 / About Formats
might be off by days, depending on the computation. SAS does not consider the
years 4000, 8000, 12000, 16000, and 20000 to be leap years.
n SAS date values can reliably tell you what day of the week a particular day
fell on as far back as September 1752. That was when the calendar was
adjusted by dropping several days. SAS day-of-the-week and length-of-time
calculations are accurate in the future to A.D. 19,900.
n Various SAS language elements handle SAS date values: functions, formats,
and informats.
SAS time value
is a value that represents the number of seconds since midnight of the current
day. SAS time values are between 0 and 86400.
SAS datetime value
is a value that represents the number of seconds between January 1, 1960, and
an hour/minute/second within a specified date.
The following figure shows some dates written in calendar form and as SAS date
values.
Figure 1.1 How SAS Converts Calendar Dates to SAS Date Values
PDJULI
SAS can perform calculations on raw SAS date values and on formatted SAS date
values. This includes performing calculations on Julian-formatted date values.
SAS uses these definitions of Julian dates and Julian formats:
Julian date
is the number of continuous days since January 1, 4713 BC, which is also known
as an astronomical date.
Julian format
is the representation of an ordinal SAS date in the form of a calendar day,
YYDDD, or YYDD.
SAS uses the Julian format (ordinal date) definition of dates. Julian-related
language elements in SAS do not convert SAS dates internally to Julian
astronomical dates. These Julian-related language elements make a SAS date look
like an ordinal date with the form YYDDD or YYYYDDD. For example, January, 23,
2018 is 18023 when you apply a Julian format in SAS.
You must define the values as SAS dates before using them in calculations. The
only way you can convert a SAS date to an astronomical date is to add 2,436,934.5
to the SAS date value. This conversion enables SAS to use the values to perform
calculations. Otherwise, SAS treats the values as regular integer numeric values,
and you might get unexpected results.
The following example performs these tasks:
n Creates a data set that contains SAS dates.
n Converts the dates to the MMDDYY10 format and the Julian format.
n Performs calculations on the two sets of dates, even though they have different
formats.
data dates; /* 1 */
input sas_date;
datalines;
21519
21522
21528
21535
21545
21555
21565
;
proc print data = dates;
run;
data dates2; /* 2 */
set dates;
formatted_sas_date = sas_date;
julian_formatted_SAS_date = sas_date;
format formatted_sas_date mmddyy10. julian_formatted_SAS_date
julian.; /* 3 */
run;
proc print data=dates2;
12 Chapter 1 / About Formats
run;
data dates3; /* 4 */
set dates2;
datediff=sas_date - lag(julian_formatted_SAS_date); /* 5 */
run;
proc print data =dates3;
run;
The following items correspond to the lines that are numbered in the preceding
DATA step.
1 Create the data set of SAS dates.
2 Convert the dates to the MMDDYY10 format and the Julian format.
3 The FORMAT statement creates the two formats for the dates.
4 Perform calculations on the formatted dates.
5 The LAG function compares the SAS date values in the previous row with the
value in the current row and returns the difference.
Definitions for Dates, Times, and Intervals 13
Figure 1.2 Converting SAS Dates and Using the Results in Calculations
14 Chapter 1 / About Formats
Five-Digit Years
Although some formats specify a width large enough to accommodate formatting a
five-digit year such as DATETIME20., SAS documentation does not display five-digit
years.
The PUT statement writes the following lines to the SAS log:
SAS date=15639
formated date=26OCT2002
Definitions for Dates, Times, and Intervals 15
Note: Whenever possible, specify a year using all four digits. Most SAS date and
time language elements support four-digit year values.
data schedule;
input @1 jobid $ @6 projdate mmddyy10.;
datalines;
A100 01/15/25
A110 03/15/2025
A200 01/30/96
B100 02/05/12
B200 06/15/2012
;
Output 1.1 Output Showing Four-Digit Years That Result from Setting YEARCUTOFF= to
1926
n The output from the fourth and fifth records shows results that are similar to the
first and second records. The fourth record specifies a two-digit year of 12, and
the fifth record specifies a four-digit year of 2012. The century in the fourth
record defaults to the 2000s because 2012 is in the range of 1926–2025. The
four-digit year in the fifth record is unaffected by the YEARCUTOFF= option.
As you can see, specifying a two-digit year might or might not result in the intended
century prefix. The optimal value of the YEARCUTOFF= option depends on the
range of the dates that you are processing.
In releases SAS 6.06 through SAS 6.12, the default value for the YEARCUTOFF=
system option is 1900. Starting with SAS 7, the default value is 1920, and starting
with SAS 9.4, the default value is 1926.
For more information about how SAS handles dates, see “Definitions for Dates,
Times, and Intervals”.
n Use the YEARCUTOFF= system option when converting two-digit dates to SAS
date values.
n Examine sets of raw data that come into your SAS process to make sure that
any dates containing two-digit years are correctly interpreted by the
YEARCUTOFF= system option. Be aware of these situations:
o Two-digit years that are distributed over more than a 100-year period. For
dates that cover more than a 100-year span, you must use either four-digit
years in the data or conditional logic in a DATA step to interpret them
correctly.
o Two-digit years that need an adjustment to the default YEARCUTOFF=
range. For example, if the default value for YEARCUTOFF= in your operating
environment is 1926 and you have a two-digit date in your data that
represents 1925, you have to adjust your YEARCUTOFF= value downward
by a year in the SAS program that processes this value.
n Ensure that output SAS data sets represent dates as SAS date values.
n Check your SAS programs to ensure that formats and informats that use two-
digit years, such as DATE7., MMDDYY6., or MMDDYY8., are reading and
writing data correctly.
Note: The YEARCUTOFF= option has no effect on dates that are already stored as
SAS date values.
Definitions for Dates, Times, and Intervals 17
Type of
Language Language
Task Element Element Input Result
DAY. 19434 17
DDMMYYB. 19434 17 03 13
Type of
Language Language
Task Element Element Input Result
JULDAY. 1 19434 76
MMDDYYB. 19434 03 17 13
Type of
Language Language
Task Element Element Input Result
MONTH. 19434 3
WEEKDAY. 19434 1
QTRR. 19434 I
Type of
Language Language
Task Element Element Input Result
1 In SAS, a Julian date is a date in the form YYNNN or YYYYNNN, where YY is a two-digit year, YYYY is a four-digit year,
and NNN is the ordinal offset from January 1 of the year YY or YYYY. SAS processes Julian dates only for valid SAS
dates.
Type of
Language Language
Task Element Element Input Result
Date Tasks
Type of
Language Language
Task Element Element Input Result
HOUR 19434 5
MINUTE 19434 23
MONTH 19434 3
QTR 19434 1
SECOND 19434 54
WEEKDAY 19434 1
Type of
Language Language
Task Element Element Input Result
Time Tasks
HOUR. 19434 5
Write the current time as SYSTIME SYSTIME &SYSTIME The time at the
a string automatic moment of
macro variable execution, in
the form
HH:MM
Return the current time of Time functions TIME( ) () The SAS time
day as a SAS time value value at the
moment of
execution, in
the form
NNNNN.NNN
Datetime Tasks
Type of
Language Language
Task Element Element Input Result
Interval Tasks
1 In SAS, a Julian date is a date in the form YYNNN or YYYYNNN, where YY is a two-digit year, YYYY is a four-digit year,
and NNN is the ordinal offset from January 1 of the year YY or YYYY. SAS processes Julian dates only for valid SAS
dates.
Examples
Note:
n Time formats count the number of seconds within a day, so the values are
between 0 and 86400.
n DATETIME formats count the number of seconds since January 1, 1960. For
datetimes that are greater than 02JAN1960:00:00:01 (integer of 86401), the
datetime value is always greater than the time value.
n When in doubt, look at the contents of your data set for clues as to which type of
value you are dealing with.
This program uses the DATETIME, DATE, and TIMEAMPM formats to display the
value 86399 to a date and time, a calendar date, and a time.
options nodate;
data test;
Time1=86399;
format Time1 datetime.;
Date1=86399;
format Date1 date9.;
Time2=86399;
format Time2 timeampm.;
run;
proc print data=test;
title 'Same Number, Different SAS Values';
footnote1 'Time1 is a SAS DATETIME value';
footnote2 'Date1 is a SAS DATE value';
footnote3 'Time2 is a SAS TIME value';
run;
footnote;
Definitions for Dates, Times, and Intervals 25
Definitions
duration
is an integer that represents the difference between any two dates or times or
datetimes. Date durations are integer values that represent the difference, in the
number of days, between two SAS dates. Time durations are decimal values that
represent the number of seconds between two times or datetimes.
interval
is a unit of measurement that SAS can count within an elapsed period of time,
such as DAYS, MONTHS, or HOURS. SAS determines date and time intervals
based on fixed points on the calendar, the clock, or both. The starting point of an
interval calculation defaults to the beginning of the period in which the beginning
value falls, which might not be the actual beginning value that is specified. For
example, if you are using the INTCK function to count the months between two
dates, regardless of the actual day of the month that is specified by the date in
the beginning value, SAS treats the date as the first of that month.
Syntax
SAS provides date, time, and datetime intervals for counting different periods of
elapsed time. You can create multiples of the intervals and shift their starting point.
Use intervals with the INTCK and INTNX functions and with procedures that support
numbered lists (such as the PLOT procedure). This is the form of an interval:
name<multiple><.starting-point>
The terms in an interval have the following definitions:
name
is the name of the interval. For a list of intervals and their definitions, see the
following table.
multiple
creates a multiple of the interval. multiple can be any positive number. The
default is 1. For example, YEAR2 indicates a two-year interval.
About Date and Time Intervals 27
.starting-point
is the starting point of the interval. By default, the starting point is 1. A value
greater than 1 shifts the start to a later point within the interval. The unit for
shifting depends on the interval, as shown in the following table. For example,
YEAR.3 specifies a yearly period from the first of March through the end of
February of the following year.
Intervals by Category
Table 1.3 Intervals Used with Date and Time Functions
Default
Starting
Category Interval Definition Point Shift Period Example Description
Default
Starting
Category Interval Definition Point Shift Period Example Description
Default
Starting
Category Interval Definition Point Shift Period Example Description
Output 1.4 Calculating the Duration between Start and End Dates
30 Chapter 1 / About Formats
Boundaries of Intervals
SAS associates date and time intervals with fixed points on the calendar. For
example, the MONTH interval represents the time from the beginning of one
calendar month to the next, not a period of 30 or 31 days. When you use date and
time intervals (for example, with the INTCK or INTNX functions), SAS bases its
calculations on the calendar divisions that are present. Consider the following
examples:
Note: The only intervals that do not begin on the same date in each year are WEEK
and WEEKDAY. A Sunday can occur on any date because the year is not divided
evenly into weeks.
Single-Unit Intervals
Single-unit intervals begin at the following points on the calendar:
n Monday–Monday
About Date and Time Intervals 31
n Tuesday–Tuesday
n Wednesday–Wednesday
n Thursday–Thursday
n Friday–Sunday
Multi-unit Intervals
example, does the first of October mark the first or the second month in a two-month
interval?
For all multi-unit intervals except multi-week intervals, SAS creates an interval that
begins on January 1, 1960, and counts forward from that date to determine where
individual intervals begin on the calendar. As a practical matter, when a year can be
divided evenly by an interval, think of the intervals as beginning with the current
year. Thus, MONTH2 intervals begin with January, March, May, July, September,
and November. Consider this example:
howmany1=intck('month2','15feb2000'd, howmany1=1
'15mar2000'd);
count=intck('day50','01oct1998'd, count=1
'01jan1999'd);
In the preceding example, SAS counts 50 days beginning with January 1, 1960,then
another 50 days, and so on. As part of this count, SAS counts one DAY50 interval
between October 1, 1998, and January 1, 1999. For example, to determine the date
on which the next DAY50 interval begins, use the INTNX function:
Multi-week Intervals
Multi-week intervals such as WEEK2 present a special case. In general, weekly
intervals begin on Sunday, and SAS counts a week whenever it passes a Sunday.
However, SAS cannot calculate multi-week intervals based on January 1, 1960,
because that date fell on a Friday, as shown here:
Dec Su Mo Tu We Th Fr Sa Jan
1959 27 28 29 30 31 1 2 1960
About Date and Time Intervals 33
Therefore, SAS begins the first interval on Sunday of the week containing January
1, 1960;that is, on Sunday, December 27, 1959. SAS counts multi-week intervals
from that point. The following example counts the number of two-week intervals in
the month of August 1998:
To see the beginning date of the next interval, use the INTNX function, as shown
here:
Shifted Intervals
For shifted intervals based on weeks, SAS first creates an interval based on Sunday
of the week containing January 1, 1960 (that is, December 27, 1959). Then, SAS
moves forward the required number of days. For example, suppose you want to
create the interval WEEK2.8 (biweekly periods beginning on the second Sunday of
the period). SAS measures a two-week interval based on Sunday of the week
containing January 1, 1960, and begins counting shifted intervals on the eighth day
of that. The INTNX function shows the beginning of the next interval.
Table 1.12 Using the INTNX Function to Show the Beginning of the Next Interval
You can also shift time intervals. For example, HOUR8.7 intervals divide the day
into the periods 06:00 to 14:00, 14:00 to 22:00, and 22:00 to 06:00.
Custom Intervals
You can define custom intervals and associate interval data sets with new interval
names when you use the INTERVALDS= system option. An interval name cannot
be a reserved SAS name. The dates for these intervals are located in a SAS data
set that you create. The data set must contain the variable Begin. For each
observation, the Begin variable represents the start of an interval. You can specify a
second variable, End, to represent the end of the interval, but it is not required. If the
End variable is not present in the data set, the end of an interval is inferred by the
next Begin variable value. After the custom intervals have been defined, you can
About Date and Time Intervals 35
use them with the INTCK and INTNX functions just as you would use standard
intervals.
The INTERVALDS= system option enables you to increase the number of allowable
intervals. In addition to the standard list of intervals (DAY, WEEKDAY, and so on),
the names that are listed in INTERVALDS= are valid as well.
Interval Description
YEARV Specifies ISO 8601 yearly intervals. The ISO 8601 year
begins on the Monday on or immediately preceding
January 4. Note that it is possible for the ISO 8601 year to
begin in December of the preceding year. Also, some ISO
8601 years contain a leap week. The beginning subperiod
s is written in ISO 8601 weeks (WEEKV).
R445YR Is the same as YEARV except that in the retail industry the
beginning subperiod s is 4-4-5 months (R445MON).
R454YR Is the same as YEARV except that in the retail industry the
beginning subperiod s is 4-5-4 months (R454MON).
R544YR Is the same as YEARV except that in the retail industry the
beginning subperiod s is 5-4-4 months (R544MON).
Interval Description
R445MON Specifies retail 4-4-5 monthly intervals. The 3rd, 6th, 9th,
and 12th months are five ISO 8601 weeks long with the
exception that some 12th months contain leap weeks. All
other months are four ISO 8601 weeks long. R445MON
intervals begin with the 1st, 5th, 9th, 14th, 18th, 22nd, 27th,
31st, 35th, 40th, 44th, and 48th weeks of the ISO year. The
beginning subperiod s is 4-4-5 months (R445MON).
R454MON Specifies retail 4-5-4 monthly intervals. The 2nd, 5th, 8th,
and 11th months are five ISO 8601 weeks long with the
exception that some 12th months contain leap weeks.
R454MON intervals begin with the 1st, 5th, 10th, 14th,
18th, 23rd, 27th, 31st, 36th, 40th, 44th, and 49th weeks of
the ISO year. The beginning subperiod s is 4-5-4 months
(R454MON).
R544MON Specifies retail 5-4-4 monthly intervals. The 1st, 4th, 7th,
and 10th months are five ISO 8601 weeks long. All other
months are four ISO 8601 weeks long with the exception
that some 12th months contain leap weeks. R544MON
intervals begin with the 1st, 6th, 10th, 14th, 19th, 23rd,
27th, 32nd, 36th, 40th, 45th, and 49th weeks of the ISO
year. The beginning subperiod s is 5-4-4 months
(R544MON).
Definitions
Integer values for binary integer data are typically stored in one of three sizes: 1
byte, 2 bytes, or 4 bytes. The ordering of the bytes for the integer varies depending
on the platform (operating environment) on which the integers were produced.
The ordering of bytes differs between the “big endian” and “little endian” platforms.
These colloquial terms are used to describe byte ordering for IBM mainframes (big
endian) and for platforms that are based on Intel (little endian). In SAS, the following
platforms are considered big endian: AIX, HP-UX, IBM mainframe, Macintosh, and
Solaris on SPARC. The following platforms are considered little endian: Intel ABI,
Linux, OpenVMS, OpenVMS on HP Integrity Servers, Solaris on x64, Tru64 UNIX,
and Windows.
The following table shows which format to use for various combinations of platforms.
In the Signed Integer column, “no” indicates that the number is unsigned and cannot
be negative. “Yes” indicates that the number can be either negative or positive.
IBM assembler H F
C short long
5 The encoding of the data set is listed, along with other information.
n when you copy and paste data between SAS sessions that are running in
different locales
For more information about SAS features that are designed to handle Transcoding
for NLS from different encodings or operating environments, see SAS National
Language Support (NLS): Reference Guide.
40 Chapter 1 / About Formats
Definitions
Packed decimal
specifies a method of encoding decimal numbers by using each byte to
represent two decimal digits. Packed decimal representation stores decimal data
with exact precision. The fractional part of the number is determined by the
informat or format because there is no separate mantissa and exponent.
An advantage of using packed decimal data is that exact precision can be
maintained. However, computations that involve decimal data might become
inexact due to the lack of native instructions.
Zoned decimal
specifies a method of encoding decimal numbers in which each digit requires 1
byte of storage. The last byte contains the number's sign as well as the last digit.
Zoned decimal data produces a printable representation.
Nibble
specifies 1/2 of a byte.
Types of Data
n You can use the S370FPD format on all platforms to obtain the IBM mainframe
configuration.
n You can have unsigned packed data with no sign indicator. The packed decimal
format and informat handle the representation. The representation is consistent
between ASCII and EBCDIC platforms.
n The S370FPDU format and informat expect to have an F in the last nibble. A
packed decimal expects no sign nibble.
IBM mainframe has an Add Pack instruction to add packed decimal data, but the
platforms that are based on Intel have no such instruction and must convert the
decimal data to some other format.
Corresponding
S370Fxxx Formats and
IBM versus COBOL II Clauses Informats
For the packed decimal representation listed in the preceding table, X indicates the
number of digits represented, and W is the number of bytes. For PIC S9(X)
PACKED-DECIMAL, W is ceil((x+1)/2). For PIC 9(X) PACKED-DECIMAL, W is
ceil(x/2). For example, PIC S9(5) PACKED-DECIMAL represents five digits. If a
sign is included, six nibbles are needed. ceil((5+1)/2) has a length of 3 bytes,
and the value of W is 3.
You can substitute COMP-3 for PACKED-DECIMAL.
In IBM assembly language, the P directive indicates packed decimal data, and the Z
directive indicates zoned decimal data. Here is an excerpt from an assembly
language list that shows the offset, the value, and the DC statement:
offset value (in hex) inst label directive
In PL/I, the FIXED DECIMAL attribute is used in conjunction with packed decimal
data. You must use the PICTURE specification to represent zoned decimal data.
There is no standardized representation of decimal data for the Fortran or C
language.
Working with Packed Decimal and Zoned Decimal Data 43
(positive) or D0
(negative) in format.
Requirement Time values that are read by the extended notation informats that
begin with the characters E8601 must use an uppercase T.
W
indicates that the duration is specified in weeks.
Z
indicates that the time value is the time in Greenwich, England, or UTC, time.
+|-
the + indicates the time zone offset to the east of Greenwich, England. The -
indicates the time zone offset to the west of Greenwich, England.
yyyy
specifies a four-digit year.
mm
as part of a date, specifies a two-digit month, 01–12.
dd
specifies a two-digit day, 01–1.
hh
specifies a two-digit hour, 00–24.
mm
as part of a time, specifies a two-digit minute, 00–59.
ss
specifies a two-digit second, 00–59.
46 Chapter 1 / About Formats
fff | ffffff
specifies an optional fraction of a second using the digits 0–9:
fff uses 1–3 digits for values read by the $N8601B informat and the
$N8601E informat.
ffffff use 1–6 digits for informats other than the $N8601B and $N8601E
informats.
Y
indicates that a year value precedes this character in a duration.
M
as part of a date, indicates that a month value precedes this character in a
duration.
D
indicates that a day value precedes this character in a duration.
H
indicates that an hour value precedes this character in a duration.
M
as part of a time, indicates that a minute value precedes this character in a
duration.
S
indicates that a seconds value precedes this character in a duration.
Definitions
Local time
is the local time when a time zone is not specified by the TIMEZONE= system
option.
Time zone offset
specifies the number of hours and minutes that a time zone is from Universal
Coordinate Time (UTC) in the form +|–hh:mm or +|–hhmm.
User local time
is the local time for the time zone that is specified by the TIMEZONE= system
option. For more information, see “TIMEZONE= System Option” in SAS System
Options: Reference.
UTC
Universal Coordinate Time is the time at the zero meridian, near Greenwich,
England. UTC is a datetime value that uses the ISO 8601 basic form
yyyymmddThhmmss+|–hhmm or the ISO 8601 extended form yyyy-mm-
ddThh:mm:ss+|–hh:mm.
Working with Dates and Times by Using the ISO 8601 Basic and Extended Notations
47
n 125234-0500 is a time with a time zone offset five hours west of the zero
meridian and is formatted using the basic notation.
n 2018-02-01T12:52:34+09:00 is a datetime value with a time zone offset nine
hours east of the zero meridian and is formatted using the extended notation.
n P20180501T120000 is a duration value that is formatted using the basic
notation.
When SAS reads an ISO 8601 value that specifies UTC with a time offset, the time
or datetime value is adjusted to account for the offset from the zero meridian.
The SAS ISO 8601 formats for UTC with a time zone offset are based on the
following time, datetime, and time zone offsets:
n the zero meridian time or datetime near Greenwich, England. (The offset is
always +|–0000 or +|–00:00.)
n the local time or datetime, which uses the zero meridian time with a time zone
offset for the local time.
n a zero meridian datetime that uses a time zone offset for the user local time.
n a user local time or datetime, which uses the current time for a time zone with a
time zone offset for the user local time.
48 Chapter 1 / About Formats
Date yyyymmdd
Time hhmmss<ffffff>
Datetime yyyymmddThhmmss<ffffff>
Time with time zone hhmmss<ffffff>+|–hhmm
Datetime with time zone yyyymmddThhmmss<ffffff>+|–hhmm
SAS uses the formats in the following table to write date, time, and datetime values
in the ISO 8601 basic notations from SAS date, time, and datetime values.
Date, Time, or
Datetime ISO 8601 Notation Example Format
Date, Time, or
Datetime ISO 8601 Notation Example Format
Date yyyy-mm-dd
Time hh:mm:ss<ffffff>
Datetime yyyy-mm-ddThh:mm:ss<ffffff>
Time with time zone hh:mm:ss<ffffff>+|–hh:mm or hh:mm:ss<ffffff>Z
Datetime with time zone yyyy-mm-ddThh:mm:ss<ffffff>+|–hh:mm or yyyy-mm-
ddThh:mm:ss<ffffff>Z
SAS uses the formats in the following table to write date, time, and datetime values
in the ISO 8601 extended notations from SAS date, time, and datetime values.
Date, Time, or
Datetime ISO 8601 Notation Example Format
Date, Time, or
Datetime ISO 8601 Notation Example Format
n A Z in the last two letters is a zero meridian time and a zero meridian offset,
except for LZ.
n An L in the last two letters is a zero meridian time with a local or user local time
zone offset.
n An X in the last two letters is for user local time or datetime and uses a user local
time zone offset that is determined by the TIMEZONE= system option.
Here is information to help you determine the format for UTC:
TZ or TX or
DZ LZ LX DX
Note: The E8601DX, E8601LX, and E8601TX formats that are used in the example
are not supported in CAS.
data _null_;
d='15Sep2018:5:53:00'dt;
tm='05:53:00't;
put 'd=' d datetime.;
put 'e8601dz=' d e8601dz.;
put 'e8601lx=' d e8601lx.;
put 'e8601dx=' d e8601dx.;
put 'tm=' tm time.;
put 'e8601tz=' tm e8601tz.;
put 'e8601lz=' tm e8601lz.;
put 'e8601tx=' tm e8601tx.;
run;
The program executed using the local time for the eastern United States and no
value for the TIMEZONE= system option. Therefore, the time zone formats
E8601LZ., E8601DX., and E8601TX. show local times.
n The output for the E8601DZ. and E8601TZ. formats writes a SAS datetime and
time value as the time at the zero meridian by using a time zone offset of +0000
or +00:00.
n The output for the E8601LX. and E8601LZ. formats writes a SAS datetime value
as the time at the zero meridian by using a time zone offset for the local time.
n The output for the E8601DX. and E8601TX. formats converts the time to Eastern
Time by using a time zone offset for the local time.
d=15SEP13:05:53:00
e8601dz= 2018-09-15T05:53:00+00:00
e8601lx= 2018-09-15T05:53:00-05:00
e8601dx= 2018-09-15T00:53:00-05:00
tm= 5:53:00
e8601tz=05:53:00+00:00
e8601lz=05:53:00-05:00
e8601tx=00:53:00-05:00
Here are the results when the TIMEZONE= option is set to America/Los_Angeles:
Working with Dates and Times by Using the ISO 8601 Basic and Extended Notations
53
d=15SEP13:05:53:00
e8601dz= 2018-09-15T05:53:00+00:00
e8601lx= 2018-09-15T05:53:00-07:00
e8601dx= 2018-09-14T22:53:00-07:00
tm= 5:53:00
e8601tz=05:53:00+00:00
e8601lz=05:53:00-05:00
e8601tx=21:53:00-08:00
n The E8601DZ. and E8601TZ. formats do not change. They always show the
time as the time at the zero meridian.
n The E8601LX. format shows the zero meridian time by using the time zone offset
for the America/Los_Angeles time zone.
n The E8601DX. formats show the local date and time in Los Angeles by using the
time zone offset for the America/Los_Angeles time zone. The Los Angeles time
zone offset of –07:00 indicates that the local time is seven hours earlier than the
time at the zero meridian. This changes the date to the 14th.
n The E8601LZ. format shows the time at the zero meridian by using the time zone
offset for the eastern United States because that is where the code executed.
n The E8601TX. format shows the time seven hours earlier from the zero meridian
by using a time zone offset for the America/Los_Angeles time zone.
var1=20180402 var2=2018-04-08
By using the B8601DNw. and E8601DNw. formats, you can extrapolate the date
from a datetime value. This example reads the datetime value by using the
B8601DNw. informat, and writes the date by using the B8601DNw. format:
data _null_;
input @1 dt b8601dn.;
put dt b8601dn.;
datalines;
54 Chapter 1 / About Formats
20180915T094322
run;
20180915
x=123456 x=12:34:56
x=16:34:56+00:00
x=163456+0000
You can adjust a time to be the time in another time zone by using a time zone
offset. You specify the time zone by using the TIMEZONE= system option, and then
format the time by using the B8601TXw. or E8601TXw. format. This example writes
the time for a user by using the time zone name PST (Pacific Time):
options timezone=pst;
Working with Dates and Times by Using the ISO 8601 Basic and Extended Notations
55
data _null_;
x='12:34:56't;
put x=e8601tx.;
run;
04:34:56-08:00
x=13:49:02-04:00
dtB=20180402T124022 dtE=2018-04-02T12:30:22
56 Chapter 1 / About Formats
This example reads and writes a Java datetime value and writes the value by using
the B8601DTw.d format:
data a;
input dt1 b8601dj.;
put dt1=b8601dt.;
datalines;
20180402123245
;
run;
dt1=20180402T123245
x=2018-08-01T16:34:56+00:00
You use the B8601DXw. and E8601DXw. formats to adjust a datetime with a time
zone offset to be the time for a specific time zone. You set the time zone by using
the TIMEZONE= system option. The input value is converted to the time for the time
zone and formatted using a time zone offset. This example reads the datetime value
with an offset (–04:00) by using the E8601DZw. informat and writes the datetime
value for the time zone in Zurich (+02:00):
options timezone='europe/zurich';
data _null_;
x=input('2018-08-01T12:34:56-04:00',e8601dz25.);
put x=e8601dx25.;
run;
x=2018-08-01T18:34:56+02:00
In this example, the TIMEZONE= system option sets the time zone ID to America/
Anchorage. The datetime value is written for this time zone ID by using the
Working with Dates and Times by Using the ISO 8601 Basic and Extended Notations
57
E8601DXw. format. The time zone offset is the difference between the America/
Anchorage time zone and UTC, which is nine hours.
options timezone='america/anchorage';
data _null_;
t='01Feb2018T12:34:56'dt;
put t=e8601dx.;
run;
2018-02-01T03:34:56-09:00
x=13:49:02-04:00
You can write a user’s local datetime value by using the time zone offset. Specify
the user’s time zone by using the TIMEZONE= system option and the B8601LXw. or
E8601LXw. format. This example writes the datetime for a user by using the time
zone name PST (Pacific Time):
options timezone=pst;
data _null_;
x='01Feb2018T12:34:56'dt;
put x=e8601lx.;
run;
2018-02-01T12:34:56-07:00
58 Chapter 1 / About Formats
n Pyyyy-mm-ddThh:mm:ss.
n PnYnMnDTnHnMnS is the number of years (Y), months (M), days (D), hours (H),
minutes (M), and seconds (S).
n PnW specifies the number of weeks.
n datetime/duration
n duration/datetime
SAS writes duration, datetime, and interval values from character data by using
these formats:
$N8601E
$N8601EA
Datetime values with missing components that are formatted with either the
$N8601B. format or the $N8601BA. format are formatted in the extended notation
that uses the hyphen for missing components to ensure accurate data. For example,
when the month is the missing component, the value 2018---15 is written, and not
2018-15.
Working with Dates and Times by Using the ISO 8601 Basic and Extended Notations
61
The extended notation with hyphens is also used instead of the basic notation if a
duration is formatted using the $N8601BA. format. Using the same date, P2018---15
is written, and not P2018-15.
n 2016-09-15T15/2018-09-15T15:53
n –p0003-03-03T-:-:-
n P2y3m4dT5h6m
n 2018-09-xxTxx:xx:xx
n 2018
p3y13m p0004-01
pt24h24m65s P----01T-:25:05
p3y13mT24h61m P0004-01-01T01:01
p0004-13 p0005-01
p0003-02-61T15:61:61 P0003-04-01T16:02:01
p13m P13M
62 Chapter 1 / About Formats
If a component contains the largest value such as 60 for minutes or seconds, SAS
normalizes the value and replaces the value with a hyphen. For example,
pT12:60:13 becomes PT13:-:13.
Thirty days is used to normalize a month.
Dates and times in a datetime value that are greater than the standard value for the
component are not normalized. They produce an error.
n P2012-09-15T10.33
n 2012-09-15/P0003-03-03,333
63
2
Dictionary of Formats
Formats by Category
Here are the categories for formats:
Category Description
Date Instructs SAS to write data values from variables that represent
dates.
See Date for a list of formats.
Date and Time Instructs SAS to write data values from variables that represent
dates, times, and datetimes.
See Date and Time for a list of formats.
ISO 8601 Instructs SAS to write date, time, and datetime values using the
ISO 8601 standard.
See ISO 8601 for a list of formats.
Time Instructs SAS to write data values from variables that represent
times.
See Time for a list of formats.
Formats that support national languages can be found in SAS National Language
Support (NLS): Reference Guide.
Storing user-defined formats is an important consideration if you associate these
formats with variables in permanent SAS data sets, especially those data sets
shared with other users. For information about creating and storing user-defined
formats, see “FORMAT Procedure” in Base SAS Procedures Guide.
The following table provides brief descriptions of the SAS formats. For more detailed
descriptions, see the dictionary entry for each format.
70 Chapter 2 / Dictionary of Formats
CAS $BASE64Xw. Format (p. Converts character data into ASCII text by using Base 64
104) encoding.
$CSTR Format (p. 108) Looks for the last non-blank character of a character
argument and passes a copy of the string with a null
terminator after the last non-blank character.
$QUOTEw. Format (p. 131) Writes data values that are enclosed in double quotation
marks.
$REVERJw. Format (p. 133) Writes character data in reverse order and preserves
blanks.
$REVERSw. Format (p. 134) Writes character data in reverse order and left-aligns
$UUIDw. Format (p. 136) Converts character data to the Universally Unique Identifier
(UUID) format.
BESTDw.p Format (p. 143) Prints numeric values, lining up decimal places for values of
similar magnitude, and prints integers without decimals.
COMMAw.d Format (p. 163) Writes numeric values with a comma that separates every
three digits and a period that separates the decimal fraction.
COMMAXw.d Format (p. Writes numeric values with a period that separates every
165) three digits and a comma that separates the decimal
fraction.
Dw.p Format (p. 166) Prints numeric values, possibly with a great range of values,
lining up decimal places for values of similar magnitude.
DATEw. Format (p. 169) Writes date values in the form ddmmmyy, ddmmmyyyy, or
dd-mmm-yyyy.
DAYw. Format (p. 175) Writes date values as the day of the month.
Formats by Category 71
DDMMYYw. Format (p. 175) Writes date values in the form ddmm<yy>yy or dd/mm/
<yy>yy, where a forward slash is the separator and the year
appears as either two or four digits.
DDMMYYxw. Format (p. Writes date values in the form ddmm<yy>yy or dd-mm-
177) yy<yy>, where the x in the format name is a character that
represents the special character that separates the day,
month, and year. The special character can be a blank
character, colon (:), hyphen (-),no separator, period (.), or
slash (/). The year can be either two or four digits.
DOLLARw.d Format (p. 180) Writes numeric values with a leading dollar sign, a comma
that separates every three digits, and a period that
separates the decimal fraction.
DOLLARXw.d Format (p. Writes numeric values with a leading dollar sign, a period
181) that separates every three digits, and a comma that
separates the decimal fraction.
DOWNAMEw. Format (p. Writes date values as the name of the day of the week.
183)
DTMONYYw. Format (p. Writes the date part of a datetime value as the month and
186) year in the form mmmyy or mmmyyyy.
DTWKDATXw. Format (p. Writes the date part of a datetime value as the day of the
187) week and the date in the form day-of-week, dd month-name
yy (or yyyy).
DTYEARw. Format (p. 189) Writes the date part of a datetime value as the year in the
form yy or yyyy.
DTYYQCw. Format (p. 190) Writes the date part of a datetime value as the year and the
quarter and separates them with a colon (:).
E8601DAw. Format (p. 193) Writes date values by using the ISO 8601 extended notation
yyyy-mm-dd.
E8601DNw. Format (p. 194) Writes dates from SAS datetime values by using the ISO
8601 extended notation yyyy-mm-dd.
E8601DTw.d Format (p. 195) Writes datetime values by using the ISO 8601 extended
notation yyyy-mm-ddThh:mm:ss.ffffff.
E8601DZw. Format (p. 199) Writes datetime values for the zero meridian Coordinated
Universal Time (UTC) by using the ISO 8601 datetime and
time zone extended notation yyyy-mm-ddThh:mm:ss+00:00.
E8601LZw. Format (p. 202) Writes time values as local time, appending the Coordinated
Universal Time (UTC) offset for the local SAS session, using
the ISO 8601 extended time notation hh:mm:ss+|–hh:mm.
72 Chapter 2 / Dictionary of Formats
E8601TMw.d Format (p. 204) Writes time values by using the ISO 8601 extended notation
hh:mm:ss.ffffff.
E8601TZw.d Format (p. 208) Adjusts time values to the Coordinated Universal Time
(UTC) and writes the time values by using the ISO 8601
extended notation hh:mm:ss.<fff>+|–hh:mm.
Fw.d Format (p. 215) Rounds the value to the nearest number that fits in the
output field.
HEXw. Format (p. 220) Converts real binary (floating-point) values to hexadecimal
representation.
HHMMw.d Format (p. 221) Writes time values as hours and minutes in the form hh:mm.
HOURw.d Format (p. 224) Writes time values as hours and decimal fractions of hours.
JULIANw. Format (p. 232) Writes date values as Julian dates in the form yyddd or
yyyyddd.
MDYAMPMw.d Format (p. Writes datetime values in the form mm/dd/yy<yy> hh:mm
233) AM|PM. The year can be either two or four digits.
MMDDYYw. Format (p. 235) Writes date values in the form mmdd<yy>yy or mm/dd/
<yy>yy, where a forward slash is the separator and the year
appears as either two or four digits.
MMDDYYxw. Format (p. Writes date values in the form mmdd<yy>yy or mm-dd-
237) <yy>yy, where the x in the format name is a character that
represents the special character that separates the month,
day, and year. The special character can be a hyphen (-),
period (.), blank character, slash (/), colon (:), or no
separator; the year can be either two or four digits.
MMSSw.d Format (p. 240) Writes time values as the number of minutes and seconds
since midnight.
MMYYw. Format (p. 241) Writes date values in the form mmM<yy>yy, where M is the
separator and the year appears as either two or four digits.
MMYYxw. Format (p. 243) Writes date values in the form mm<yy>yy or mm-<yy>yy,
where the x in the format name is a character that
represents the special character that separates the month
and the year. The special character can be a hyphen (-),
period (.), blank character, slash (/), colon (:), or no
separator. The year can be either two or four digits.
Formats by Category 73
MONNAMEw. Format (p. Writes date values as the name of the month.
245)
MONTHw. Format (p. 246) Writes date values as the month of the year.
MONYYw. Format (p. 247) Writes date values as the month and the year in the form
mmmyy or mmmyyyy.
NLBESTw. Format (p. 252) Writes the best numerical notation based on the locale.
NLDATEw. Format (p. 255) Writes a SAS date value as a date that is appropriate for the
current SAS locale.
NLDATELw. Format (p. 256) Writes a SAS date value as a date in the form month, date,
year that is appropriate for the current SAS locale.
NLDATEMw. Format (p. 257) Writes a SAS date value as a date in a medium-uniform
pattern that is appropriate for the current SAS locale.
NLDATEMDw. Format (p. Writes the SAS date value as the name of the month and
258) the day of the month that is appropriate for the current SAS
locale.
NLDATEMDLw. Format (p. Writes a SAS date value as the month and day of the month
259) that is appropriate for the current SAS locale.
NLDATEMDMw. Format (p. Writes a SAS date value as the month and day of the month
260) that is appropriate for the current SAS locale.
NLDATEMDSw. Format (p. Writes a SAS date value as the month and day of the month
261) in a short-uniform pattern that is appropriate for the current
SAS locale.
NLDATEMNw. Format (p. Writes a SAS date value as the name of the month that is
262) appropriate for the current SAS locale.
NLDATESw. Format (p. 264) Writes a SAS date value as a date string that is appropriate
for the current SAS locale.
NLDATEWw. Format (p. 265) Writes a SAS date value as the date and the day of the
week that is appropriate for the current SAS locale.
NLDATEWNw. Format (p. Writes the SAS date value as the day of the week that is
267) appropriate for the current SAS locale.
NLDATEYMw. Format (p. Writes the SAS date value as the year and the name of the
268) month that is appropriate for the current SAS locale.
NLDATEYMLw. Format (p. Writes a SAS date value as the month and year that is
270) appropriate for the current SAS locale.
74 Chapter 2 / Dictionary of Formats
NLDATEYMMw. Format (p. Writes a SAS date value as the month and year with
271) abbreviations that is appropriate for the current SAS locale.
NLDATEYMSw. Format (p. Writes a SAS date value as a date and year that is
272) appropriate for the current SAS locale.
NLDATEYQw. Format (p. Writes the SAS date value as the year and the quarter that
273) is appropriate for the current SAS locale.
NLDATEYQLw. Format (p. Writes a SAS date value as the year and the year’s quarter
274) value (Q1–Q4) using abbreviations that is appropriate for
the current SAS locale.
NLDATEYQMw. Format (p. Writes a SAS date value as the year and the year’s quarter
276) value (Q1–Q4) using abbreviations that is appropriate for
the current SAS locale.
NLDATEYQSw. Format (p. Writes a SAS date value as the year and the year’s quarter
277) value (1–4) with numbers and delimiters that is appropriate
for the current SAS locale.
NLDATEYRw. Format (p. Writes the SAS date value as the year that is appropriate for
278) the current SAS locale.
NLDATEYWw. Format (p. Writes the SAS date value as the year and the week that is
279) appropriate for the current SAS locale.
NLDATMw. Format (p. 280) Writes a SAS datetime value as a datetime that is
appropriate for the current SAS locale.
NLDATMAPw. Format (p. Wries a SAS datetime value as a datetime with a.m. or p.m.
281) that is appropriate for the current SAS locale.
NLDATMDTw. Format (p. Writes the SAS datetime value as the name of the month,
282) day of the month and year that is appropriate for the current
SAS locale.
NLDATMLw. Format (p. 284) Writes a SAS datetime value as a long representation of the
date that is appropriate for the current SAS locale.
NLDATMMw. Format (p. 285) Writes a SAS datetime value as a medium representation of
the date that is appropriate for the current SAS locale.
NLDATMMDw. Format (p. Writes the SAS datetime value as the name of the month
286) and the day of the month that is appropriate for the current
SAS locale.
NLDATMMDLw. Format (p. Writes a SAS date value as the full-length of the month and
287) day of the month that is appropriate for the current SAS
locale.
NLDATMMDMw. Format (p. Writes a SAS date value as the month and day of the month
288) using abbreviations that is appropriate for the current SAS
locale.
Formats by Category 75
NLDATMMDSw. Format (p. Writes a SAS date value as the month and day of the month
289) using numbers and delimiters that is appropriate for the
current SAS locale.
NLDATMMNw. Format (p. Writes the SAS datetime value as the name of the month
290) that is appropriate for the current SAS locale.
NLDATMSw. Format (p. 292) Writes a SAS datetime value as the short representation of
the date that is appropriate for the current SAS locale.
NLDATMTMw. Format (p. Writes the time portion of a SAS datetime value as a time of
293) day that is appropriate for the current SAS locale.
NLDATMTZw. Format (p. Writes the time portion of the SAS datetime value as the
294) time of day and time zone that is appropriate for the current
SAS locale.
NLDATMWw. Format (p. Writes SAS datetime values as the day of the week and the
295) datetime that is appropriate for the current SAS locale.
NLDATMWNw. Format (p. Writes a SAS datetime value as the day of the week that is
297) appropriate for the current SAS locale.
NLDATMWZw. Format (p. Writes SAS date values as day-of-week, datetime, and time
298) zone values that are appropriate.
NLDATMYMw. Format (p. Writes the SAS datetime value as the month and year that is
299) appropriate for the current SAS locale.
NLDATMYMLw. Format (p. Writes a SAS date value as the month and the year that is
300) appropriate for the current SAS locale.
NLDATMYMMw. Format (p. Writes a SAS date value as the month and the year that is
301) appropriate for the current SAS locale.
NLDATMYMSw. Format (p. Writes a SAS date value as the month and year with
302) numbers and a delimiter that is appropriate for the current
SAS locale.
NLDATMYQw. Format (p. Writes the SAS datetime value as the quarter and the year
303) that is appropriate for the current SAS locale.
NLDATMYQMw. Format (p. Writes a SAS date value as the year’s quarter (1–4) and the
305) year that is appropriate for the current SAS locale.
NLDATMYQSw. Format (p. Writes a SAS date value as the year and the quarter (1-4)
306) using numbers and a delimiter that is appropriate for the
current SAS locale.
NLDATMYRw. Format (p. Writes the SAS datetime value as the year that is
308) appropriate for the current SAS locale.
NLDATMYWw. Format (p. Writes the SAS datetime value as the week number and the
309) year that is appropriate for the current SAS locale.
76 Chapter 2 / Dictionary of Formats
NLDATMZw. Format (p. 310) Writes SAS datetime values as datetime and time zone
values that are appropriate for the current SAS locale.
NLMNIAEDw.d Format (p. Writes the monetary format of the international expression
310) for the United Arab Emirates.
NLMNIAUDw.d Format (p. Writes the monetary format of the international expression
312) for Australia.
NLMNIBGNw.d Format (p. Writes the monetary format of the international expression
313) for Bulgaria.
NLMNIBRLw.d Format (p. Writes the monetary format of the international expression
314) for Brazil.
NLMNICADw.d Format (p. Writes the monetary format of the international expression
315) for Canada.
NLMNICHFw.d Format (p. Writes the monetary format of the international expression
316) for Liechtenstein and Switzerland.
NLMNICNYw.d Format (p. Writes the monetary format of the international expression
317) for China.
NLMNICZKw.d Format (p. Writes the monetary format of the international expression
319) for the Czech Republic.
NLMNIDKKw.d Format (p. Writes the monetary format of the international expression
320) for Denmark, Faroe Island, and Greenland.
NLMNIEEKw.d Format (p. Writes the monetary format of the international expression
321) for Estonia.
NLMNIEGPw.d Format (p. Writes the monetary format of the international expression
322) for Egypt.
NLMNIEURw.d Format (p. Writes the monetary format of the international expression
323) for Austria, Belgium, Cyprus, Estonia, Finland, France,
Germany, Greece, Ireland, Italy, Latvia, Lithuania,
Luxembourg, Malta, the Netherlands, Portugal, Slovakia,
Slovenia, and Spain.
NLMNIGBPw.d Format (p. Writes the monetary format of the international expression
324) for the United Kingdom.
NLMNIHKDw.d Format (p. Writes the monetary format of the international expression
326) for Hong Kong.
NLMNIHRKw.d Format (p. Writes the monetary format of the international expression
327) for Croatia.
NLMNIHUFw.d Format (p. Writes the monetary format of the international expression
328) for Hungary.
Formats by Category 77
NLMNIIDRw.d Format (p. Writes the monetary format of the international expression
329) for Indonesia.
NLMNIILSw.d Format (p. Writes the monetary format of the international expression
330) for Israel.
NLMNIINRw.d Format (p. Writes the monetary format of the international expression
331) for India.
NLMNIKRWw.d Format (p. Writes the monetary format of the international expression
334) for South Korea.
NLMNILTLw.d Format (p. Writes the monetary format of the international expression
335) for Lithuania.
NLMNILVLw.d Format (p. Writes the monetary format of the international expression
336) for Latvia.
NLMNIMOPw.d Format (p. Writes the monetary format of the international expression
337) for Macau.
NLMNIMXNw.d Format (p. Writes the monetary format of the international expression
338) for Mexico.
NLMNIMYRw.d Format (p. Writes the monetary format of the international expression
340) for Malaysia.
NLMNINOKw.d Format (p. Writes the monetary format of the international expression
341) for Norway.
NLMNINZDw.d Format (p. Writes the monetary format of the international expression
342) for New Zealand.
NLMNIPLNw.d Format (p. Writes the monetary format of the international expression
343) for Poland.
NLMNIRUBw.d Format (p. Writes the monetary format of the international expression
344) for Russia.
NLMNISEKw.d Format (p. Writes the monetary format of the international expression
345) for Sweden.
NLMNISGDw.d Format (p. Writes the monetary format of the international expression
347) for Singapore.
NLMNITHBw.d Format (p. Writes the monetary format of the international expression
348) for Thailand.
NLMNITRYw.d Format (p. Writes the monetary format of the international expression
349) for Turkey.
NLMNITWDw.d Format (p. Writes the monetary format of the international expression
350) for Taiwan.
78 Chapter 2 / Dictionary of Formats
NLMNIUSDw.d Format (p. Writes the monetary format of the international expression
351) for Puerto Rico and the United States.
NLMNIZARw.d Format (p. Writes the monetary format of the international expression
352) for South Africa.
NLMNLAEDx.d Format (p. Writes the monetary format of the local expression for the
354) United Arab Emirates.
NLMNLAUDw.d Format (p. Writes the monetary format of the local expression for
355) Australia.
NLMNLBGNw.d Format (p. Writes the monetary format of the local expression for
356) Bulgaria.
NLMNLBRLw.d Format (p. Writes the monetary format of the local expression for Brazil.
357)
NLMNLCADw.d Format (p. Writes the monetary format of the local expression for
358) Canada.
NLMNLCHFw.d Format (p. Writes the monetary format of the local expression for
359) Liechtenstein and Switzerland.
NLMNLCNYw.d Format (p. Writes the monetary format of the local expression for
361) China.
NLMNLCZKw.d Format (p. Writes the monetary format of the local expression for the
362) Czech Republic.
NLMNLDKKw.d Format (p. Writes the monetary format of the local expression for
363) Denmark, Faroe Island, and Greenland.
NLMNLEEKw.d Format (p. Writes the monetary format of the local expression for
364) Estonia.
NLMNLEGPw.d Format (p. Writes the monetary format of the local expression for
365) Egypt.
NLMNLEURw.d Format (p. Writes the monetary format of the local expression for
366) Austria, Belgium, Cyprus, Estonia, Finland, France,
Germany, Greece, Ireland, Italy, Latvia, Lithuania,
Luxembourg, Malta, the Netherlands, Portugal, Slovakia,
Slovenia, and Spain.
NLMNLGBPw.d Format (p. Writes the monetary format of the local expression for the
368) United Kingdom.
NLMNLHKDw.d Format (p. Writes the monetary format of the local expression for Hong
369) Kong.
NLMNLHRKw.d Format (p. Writes the monetary format of the local expression for
370) Croatia.
Formats by Category 79
NLMNLHUFw.d Format (p. Writes the monetary format of the local expression for
371) Hungary.
NLMNLIDRw.d Format (p. Writes the monetary format of the local expression for
372) Indonesia.
NLMNLILSw.d Format (p. Writes the monetary format of the local expression for Israel.
373)
NLMNLINRw.d Format (p. Writes the monetary format of the local expression for India.
375)
NLMNLJPYw.d Format (p. Writes the monetary format of the international expression
376) for Japan.
NLMNLKRWw.d Format (p. Writes the monetary format of the local expression for South
377) Korea.
NLMNLLTLw.d Format (p. Writes the monetary format of the local expression for
378) Lithuania.
NLMNLLVLw.d Format (p. Writes the monetary format of the local expression for
379) Latvia.
NLMNLMOPw.d Format (p. Writes the monetary format of the local expression for
380) Macau.
NLMNLMXNw.d Format (p. Writes the monetary format of the local expression for
382) Mexico.
NLMNLMYRw.d Format (p. Writes the monetary format of the local expression for
383) Malaysia.
NLMNLNOKw.d Format (p. Writes the monetary format of the local expression for
384) Norway.
NLMNLNZDw.d Format (p. Writes the monetary format of the local expression for New
385) Zealand.
NLMNLPLNw.d Format (p. Writes the monetary format of the local expression for
386) Poland.
NLMNLRUBw.d Format (p. Writes the monetary format of the local expression for
387) Russia.
NLMNLSEKw.d Format (p. Writes the monetary format of the local expression for
389) Sweden.
NLMNLSGDw.d Format (p. Writes the monetary format of the local expression for
390) Singapore.
NLMNLTHBw.d Format (p. Writes the monetary format of the local expression for
391) Thailand.
80 Chapter 2 / Dictionary of Formats
NLMNLTRYw.d Format (p. Writes the monetary format of the local expression for
392) Turkey.
NLMNLTWDw.d Format (p. Writes the monetary format of the local expression for
393) Taiwan.
NLMNLUSDw.d Format (p. Writes the monetary format of the local expression for
394) Puerto Rico and the United States.
NLMNLZARw.d Format (p. Writes the monetary format of the local expression for South
396) Africa.
NLMNYw.d Format (p. 397) Writes the monetary format of the local expression that is
appropriate for the current SAS locale.
NLMNYIw.d Format (p. 398) Writes the monetary format of the international expression
that is appropriate for the current SAS locale.
NLNUMw.d Format (p. 400) Writes the numeric format of the local expression that is
appropriate for the current SAS locale.
NLNUMIw.d Format (p. 402) Writes the numeric format of the international expression
that is appropriate for the current SAS locale.
NLPCTw.d Format (p. 403) Writes percentage data of the local expression that is
appropriate for the current SAS locale.
NLPCTIw.d Format (p. 405) Writes percentage data of the international expression that
is appropriate for the current SAS locale.
NLPCTNw.d Format (p. 407) Writes percentages, using a minus sign for negative values.
NLPVALUEw.d Format (p. Writes p-values of the local expression that is appropriate
409) for the current SAS locale.
NLSTRMONw.d Format (p. Writes the month name that is appropriate for the current
410) SAS locale.
NLTIMAPw. Format (p. 415) Writes a SAS time value as a time value with a.m. or p.m.
that is appropriate for the current SAS locale.
NLTIMEw. Format (p. 416) Writes a SAS time value as a time value that is appropriate
for the current SAS locale.
PERCENTNw.d Format (p. Produces percentages, using a minus sign for negative
429) values.
QTRw. Format (p. 438) Writes date values as the quarter of the year.
QTRRw. Format (p. 439) Writes date values as the quarter of the year in Roman
numerals.
TIMEw.d Format (p. 463) Writes time values as hours, minutes, and seconds in the
form hh:mm:ss.ss.
TIMEAMPMw.d Format (p. Writes time and datetime values as hours, minutes, and
466) seconds in the form hh:mm:ss.ss with AM or PM.
TODw.d Format (p. 468) Writes SAS time values and the time portion of SAS
datetime values in the form hh:mm:ss.ss.
VAXRBw.d Format (p. 471) Writes real binary (floating-point) data in VMS format.
w.d Format (p. 474) Writes standard numeric data one digit per byte.
WEEKDATXw. Format (p. Writes date values as the day of the week and date in the
478) form day-of-week, dd month-name yy (or yyyy).
WEEKDAYw. Format (p. Writes date values as the day of the week.
480)
YYMMw. Format (p. 495) Writes date values in the form <yy>yyMmm, where M is a
character separator to indicate that the month number
follows the M and the year appears as either two or four
digits.
YYMMDDw. Format (p. 496) Writes date values in the form yymmdd or <yy>yy-mm-dd,
where a hyphen is the separator and the year appears as
either two or four digits.
YYMMDDxw. Format (p. Writes date values in the form yymmdd or <yy>yy-mm-dd,
499) where the x in the format name is a character that
represents the special character that separates the year,
month, and day. The special character can be a hyphen (-),
period (.), blank character, slash (/), colon (:), or no
separator. The year can be either two or four digits.
YYMMxw. Format (p. 501) Writes date values in the form <yy>yymm or <yy>yy-mm.
The x in the format name represents the special character
that separates the year and the month. This special
character can be a hyphen (-), period (.), slash (/), colon (:),
or no separator. The year can be either two or four digits.
82 Chapter 2 / Dictionary of Formats
YYMONw. Format (p. 503) Writes date values in the form yymmm or yyyymmm.
YYQw. Format (p. 504) Writes date values in the form <yy>yyQq, where Q is the
separator, the year appears as either two or four digits, and
q is the quarter of the year.
YYQxw. Format (p. 506) Writes date values in the form <yy>yyq or <yy>yy-q, where
the x in the format name is a character that represents the
special character that separates the year and the quarter or
the year. The special character can be a hyphen (-), period
(.), blank character, slash (/), colon (:), or no separator. The
year can be either two or four digits.
YYQRw. Format (p. 508) Writes date values in the form <yy>yyQqr, where Q is the
separator, the year appears as either two or four digits, and
qr is the quarter of the year expressed in Roman numerals.
YYQRxw. Format (p. 510) Writes date values in the form <yy>yyqr or <yy>yy-qr, where
the x in the format name is a character that represents the
special character. The special character separates the year
and the quarter or the year. The special character can be a
hyphen (-), period (.), blank character, slash (/), colon (:), or
no separator. The year can be either two or four digits, and
qr is the quarter of the year expressed in Roman numerals.
YYQZw. Format (p. 512) Writes SAS date values in the form <yy><qq>, the year
appears as 2 or 4 digits, and qq is the quarter of the year.
YYWEEKUw. Format (p. Writes a week number in decimal format by using the U
513) algorithm, excluding day-of-the-week information.
YYWEEKVw. Format (p. Writes a week number in decimal format by using the V
515) algorithm, excluding day-of-the-week information.
YYWEEKWw. Format (p. Writes a week number in decimal format by using the W
517) algorithm, excluding the day-of-week information.
Zw.d Format (p. 519) Writes standard numeric data with leading 0s.
Character $ASCIIw. Format (p. 102) Converts native format character data to ASCII
representation.
$BASE64Xw. Format (p. Converts character data into ASCII text by using Base 64
104) encoding.
$CSTR Format (p. 108) Looks for the last non-blank character of a character
argument and passes a copy of the string with a null
terminator after the last non-blank character.
$EBCDICw. Format (p. 109) Converts native format character data to EBCDIC
representation.
Formats by Category 83
$MSGCASEw. Format (p. Writes character data in uppercase when the MSGCASE
112) system option is in effect.
$QUOTEw. Format (p. 131) Writes data values that are enclosed in double quotation
marks.
$REVERJw. Format (p. 133) Writes character data in reverse order and preserves
blanks.
$REVERSw. Format (p. 134) Writes character data in reverse order and left-aligns
$UUIDw. Format (p. 136) Converts character data to the Universally Unique Identifier
(UUID) format.
Date B8601DAw. Format (p. 146) Writes date values by using the ISO 8601 basic notation
yyyymmdd.
B8601DNw. Format (p. 148) Writes dates from datetime values by using the ISO 8601
basic notation yyyymmdd.
DATEw. Format (p. 169) Writes date values in the form ddmmmyy, ddmmmyyyy, or
dd-mmm-yyyy.
DAYw. Format (p. 175) Writes date values as the day of the month.
DDMMYYw. Format (p. 175) Writes date values in the form ddmm<yy>yy or dd/mm/
<yy>yy, where a forward slash is the separator and the year
appears as either two or four digits.
DDMMYYxw. Format (p. Writes date values in the form ddmm<yy>yy or dd-mm-
177) yy<yy>, where the x in the format name is a character that
represents the special character that separates the day,
month, and year. The special character can be a blank
character, colon (:), hyphen (-),no separator, period (.), or
slash (/). The year can be either two or four digits.
DOWNAMEw. Format (p. Writes date values as the name of the day of the week.
183)
DTDATEw. Format (p. 184) Expects a datetime value as input and writes date values in
the form ddmmmyy or ddmmmyyyy.
84 Chapter 2 / Dictionary of Formats
DTMONYYw. Format (p. Writes the date part of a datetime value as the month and
186) year in the form mmmyy or mmmyyyy.
DTWKDATXw. Format (p. Writes the date part of a datetime value as the day of the
187) week and the date in the form day-of-week, dd month-name
yy (or yyyy).
DTYEARw. Format (p. 189) Writes the date part of a datetime value as the year in the
form yy or yyyy.
DTYYQCw. Format (p. 190) Writes the date part of a datetime value as the year and the
quarter and separates them with a colon (:).
E8601DAw. Format (p. 193) Writes date values by using the ISO 8601 extended notation
yyyy-mm-dd.
E8601DNw. Format (p. 194) Writes dates from SAS datetime values by using the ISO
8601 extended notation yyyy-mm-dd.
JULDAYw. Format (p. 230) Writes date values as the Julian day of the year.
JULIANw. Format (p. 232) Writes date values as Julian dates in the form yyddd or
yyyyddd.
MMDDYYw. Format (p. 235) Writes date values in the form mmdd<yy>yy or mm/dd/
<yy>yy, where a forward slash is the separator and the year
appears as either two or four digits.
MMDDYYxw. Format (p. Writes date values in the form mmdd<yy>yy or mm-dd-
237) <yy>yy, where the x in the format name is a character that
represents the special character that separates the month,
day, and year. The special character can be a hyphen (-),
period (.), blank character, slash (/), colon (:), or no
separator; the year can be either two or four digits.
MMYYw. Format (p. 241) Writes date values in the form mmM<yy>yy, where M is the
separator and the year appears as either two or four digits.
MMYYxw. Format (p. 243) Writes date values in the form mm<yy>yy or mm-<yy>yy,
where the x in the format name is a character that
represents the special character that separates the month
and the year. The special character can be a hyphen (-),
period (.), blank character, slash (/), colon (:), or no
separator. The year can be either two or four digits.
MONNAMEw. Format (p. Writes date values as the name of the month.
245)
MONTHw. Format (p. 246) Writes date values as the month of the year.
MONYYw. Format (p. 247) Writes date values as the month and the year in the form
mmmyy or mmmyyyy.
NENGOw. Format (p. 251) Writes date values as Japanese dates in the form
e.yymmdd.
Formats by Category 85
NLDATEw. Format (p. 255) Writes a SAS date value as a date that is appropriate for the
current SAS locale.
NLDATELw. Format (p. 256) Writes a SAS date value as a date in the form month, date,
year that is appropriate for the current SAS locale.
NLDATEMw. Format (p. 257) Writes a SAS date value as a date in a medium-uniform
pattern that is appropriate for the current SAS locale.
NLDATEMDw. Format (p. Writes the SAS date value as the name of the month and
258) the day of the month that is appropriate for the current SAS
locale.
NLDATEMDLw. Format (p. Writes a SAS date value as the month and day of the month
259) that is appropriate for the current SAS locale.
NLDATEMDMw. Format (p. Writes a SAS date value as the month and day of the month
260) that is appropriate for the current SAS locale.
NLDATEMDSw. Format (p. Writes a SAS date value as the month and day of the month
261) in a short-uniform pattern that is appropriate for the current
SAS locale.
NLDATEMNw. Format (p. Writes a SAS date value as the name of the month that is
262) appropriate for the current SAS locale.
NLDATESw. Format (p. 264) Writes a SAS date value as a date string that is appropriate
for the current SAS locale.
NLDATEWw. Format (p. 265) Writes a SAS date value as the date and the day of the
week that is appropriate for the current SAS locale.
NLDATEWNw. Format (p. Writes the SAS date value as the day of the week that is
267) appropriate for the current SAS locale.
NLDATEYMw. Format (p. Writes the SAS date value as the year and the name of the
268) month that is appropriate for the current SAS locale.
NLDATEYMLw. Format (p. Writes a SAS date value as the month and year that is
270) appropriate for the current SAS locale.
NLDATEYMMw. Format (p. Writes a SAS date value as the month and year with
271) abbreviations that is appropriate for the current SAS locale.
NLDATEYMSw. Format (p. Writes a SAS date value as a date and year that is
272) appropriate for the current SAS locale.
NLDATEYQw. Format (p. Writes the SAS date value as the year and the quarter that
273) is appropriate for the current SAS locale.
NLDATEYQLw. Format (p. Writes a SAS date value as the year and the year’s quarter
274) value (Q1–Q4) using abbreviations that is appropriate for
the current SAS locale.
86 Chapter 2 / Dictionary of Formats
NLDATEYQMw. Format (p. Writes a SAS date value as the year and the year’s quarter
276) value (Q1–Q4) using abbreviations that is appropriate for
the current SAS locale.
NLDATEYQSw. Format (p. Writes a SAS date value as the year and the year’s quarter
277) value (1–4) with numbers and delimiters that is appropriate
for the current SAS locale.
NLDATEYRw. Format (p. Writes the SAS date value as the year that is appropriate for
278) the current SAS locale.
NLDATEYWw. Format (p. Writes the SAS date value as the year and the week that is
279) appropriate for the current SAS locale.
NLDATMDTw. Format (p. Writes the SAS datetime value as the name of the month,
282) day of the month and year that is appropriate for the current
SAS locale.
NLDATMMDw. Format (p. Writes the SAS datetime value as the name of the month
286) and the day of the month that is appropriate for the current
SAS locale.
NLDATMMDLw. Format (p. Writes a SAS date value as the full-length of the month and
287) day of the month that is appropriate for the current SAS
locale.
NLDATMMDMw. Format (p. Writes a SAS date value as the month and day of the month
288) using abbreviations that is appropriate for the current SAS
locale.
NLDATMMDSw. Format (p. Writes a SAS date value as the month and day of the month
289) using numbers and delimiters that is appropriate for the
current SAS locale.
NLDATMMNw. Format (p. Writes the SAS datetime value as the name of the month
290) that is appropriate for the current SAS locale.
NLDATMWZw. Format (p. Writes SAS date values as day-of-week, datetime, and time
298) zone values that are appropriate.
NLDATMYMLw. Format (p. Writes a SAS date value as the month and the year that is
300) appropriate for the current SAS locale.
NLDATMYMMw. Format (p. Writes a SAS date value as the month and the year that is
301) appropriate for the current SAS locale.
NLDATMYMSw. Format (p. Writes a SAS date value as the month and year with
302) numbers and a delimiter that is appropriate for the current
SAS locale.
NLDATMYQLw. Format (p. Writes a SAS date value as the year’s quarter value (1–4)
304) and the year that is appropriate for the current SAS locale.
NLDATMYQMw. Format (p. Writes a SAS date value as the year’s quarter (1–4) and the
305) year that is appropriate for the current SAS locale.
Formats by Category 87
NLDATMYQSw. Format (p. Writes a SAS date value as the year and the quarter (1-4)
306) using numbers and a delimiter that is appropriate for the
current SAS locale.
PDJULGw. Format (p. 424) Writes packed Julian date values in the hexadecimal format
yyyydddF for IBM.
PDJULIw. Format (p. 426) Writes packed Julian date values in the hexadecimal format
ccyydddF for IBM.
QTRw. Format (p. 438) Writes date values as the quarter of the year.
QTRRw. Format (p. 439) Writes date values as the quarter of the year in Roman
numerals.
WEEKDATEw. Format (p. Writes date values as the day of the week and the date in
476) the form day-of-week, month-name dd, yy (or yyyy).
WEEKDATXw. Format (p. Writes date values as the day of the week and date in the
478) form day-of-week, dd month-name yy (or yyyy).
WEEKDAYw. Format (p. Writes date values as the day of the week.
480)
WEEKUw. Format (p. 481) Writes a week number in decimal format by using the U
algorithm.
WEEKVw. Format (p. 483) Writes a week number in decimal format by using the V
algorithm.
WEEKWw. Format (p. 485) Writes a week number in decimal format by using the W
algorithm.
WORDDATEw. Format (p. Writes date values as the name of the month, the day, and
487) the year in the form month-name dd, yyyy.
WORDDATXw. Format (p. Writes date values as the day, the name of the month, and
489) the year in the form dd month-name yyyy.
YYMMw. Format (p. 495) Writes date values in the form <yy>yyMmm, where M is a
character separator to indicate that the month number
follows the M and the year appears as either two or four
digits.
YYMMDDw. Format (p. 496) Writes date values in the form yymmdd or <yy>yy-mm-dd,
where a hyphen is the separator and the year appears as
either two or four digits.
YYMMDDxw. Format (p. Writes date values in the form yymmdd or <yy>yy-mm-dd,
499) where the x in the format name is a character that
represents the special character that separates the year,
month, and day. The special character can be a hyphen (-),
88 Chapter 2 / Dictionary of Formats
YYMMxw. Format (p. 501) Writes date values in the form <yy>yymm or <yy>yy-mm.
The x in the format name represents the special character
that separates the year and the month. This special
character can be a hyphen (-), period (.), slash (/), colon (:),
or no separator. The year can be either two or four digits.
YYMONw. Format (p. 503) Writes date values in the form yymmm or yyyymmm.
YYQw. Format (p. 504) Writes date values in the form <yy>yyQq, where Q is the
separator, the year appears as either two or four digits, and
q is the quarter of the year.
YYQxw. Format (p. 506) Writes date values in the form <yy>yyq or <yy>yy-q, where
the x in the format name is a character that represents the
special character that separates the year and the quarter or
the year. The special character can be a hyphen (-), period
(.), blank character, slash (/), colon (:), or no separator. The
year can be either two or four digits.
YYQRw. Format (p. 508) Writes date values in the form <yy>yyQqr, where Q is the
separator, the year appears as either two or four digits, and
qr is the quarter of the year expressed in Roman numerals.
YYQRxw. Format (p. 510) Writes date values in the form <yy>yyqr or <yy>yy-qr, where
the x in the format name is a character that represents the
special character. The special character separates the year
and the quarter or the year. The special character can be a
hyphen (-), period (.), blank character, slash (/), colon (:), or
no separator. The year can be either two or four digits, and
qr is the quarter of the year expressed in Roman numerals.
Date and Time $N8601Bw.d Format (p. 113) Writes ISO 8601 duration, datetime, and interval forms by
using the basic notations PnYnMnDTnHnMnS and
yyyymmddThhmmss.
$N8601BAw.d Format (p. Writes ISO 8601 duration, datetime, and interval forms by
115) using the basic notations PyyyymmddThhmmss and
yyyymmddThhmmss.
$N8601Ew.d Format (p. 117) Writes ISO 8601 duration, datetime, and interval forms by
using the extended notations PnYnMnDTnHnMnS and yyyy-
mm-ddThh:mm:ss.
$N8601EAw.d Format (p. Writes ISO 8601 duration, datetime, and interval forms by
120) using the extended notations Pyyyy-mm-ddThh:mm:ss and
yyyy-mm-ddThh:mm:ss.
$N8601EHw.d Format (p. Writes ISO 8601 duration, datetime, and interval forms by
122) using the extended notations Pyyyy-mm-ddThh:mm:ss and
yyyy-mm-ddThh:mm:ss, using a hyphen (-) for omitted
components.
Formats by Category 89
$N8601EXw.d Format (p. Writes ISO 8601 duration, datetime, and interval forms by
124) using the extended notations Pyyyy-mm-ddThh:mm:ss and
yyyy-mm-ddThh:mm:ss, using an x for each digit of an
omitted component.
$N8601Hw.d Format (p. 126) Writes ISO 8601 duration, datetime, and interval forms
PnYnMnDTnHnMnS and yyyy-mm-ddThh:mm:ss, dropping
omitted components in duration values and using a hyphen
(-) for omitted components in datetime values.
$N8601Xw.d Format (p. 128) Writes ISO 8601 duration, datetime, and interval forms
PnYnMnDTnHnMnS and yyyy-mm-ddThh:mm:ss, dropping
omitted components in duration values and using an x for
each digit of an omitted component in datetime values.
B8601DNw. Format (p. 148) Writes dates from datetime values by using the ISO 8601
basic notation yyyymmdd.
B8601DTw.d Format (p. 149) Writes datetime values by using the ISO 8601 basic notation
yyyymmddThhmmss<ffffff>.
B8601DXw. Format (p. 151) Adjusts a Coordinated Universal Time (UTC) datetime value
to the user’s local date and time. Then, writes the local date
and time by using the ISO 8601 datetime and time zone
basic notation yyyymmddThhmmss+hhmm.
B8601DZw. Format (p. 153) Writes datetime values for the zero meridian Coordinated
Universal Time (UTC) time by using the ISO 8601 datetime
and time zone basic notation yyyymmddThhmmss+0000.
B8601LXw. Format (p. 154) Writes datetime values as local time by appending a time
zone offset difference between the local time and UTC,
using the ISO 8601 basic notation yyyymmddThhmmss+|–
hhmm.
B8601LZw. Format (p. 156) Writes time values as local time by appending a time zone
offset difference between the local time and UTC, using the
ISO 8601 basic time notation hhmmss+|–hhmm.
DTDATEw. Format (p. 184) Expects a datetime value as input and writes date values in
the form ddmmmyy or ddmmmyyyy.
DTMONYYw. Format (p. Writes the date part of a datetime value as the month and
186) year in the form mmmyy or mmmyyyy.
DTWKDATXw. Format (p. Writes the date part of a datetime value as the day of the
187) week and the date in the form day-of-week, dd month-name
yy (or yyyy).
90 Chapter 2 / Dictionary of Formats
DTYEARw. Format (p. 189) Writes the date part of a datetime value as the year in the
form yy or yyyy.
DTYYQCw. Format (p. 190) Writes the date part of a datetime value as the year and the
quarter and separates them with a colon (:).
E8601DNw. Format (p. 194) Writes dates from SAS datetime values by using the ISO
8601 extended notation yyyy-mm-dd.
E8601DTw.d Format (p. 195) Writes datetime values by using the ISO 8601 extended
notation yyyy-mm-ddThh:mm:ss.ffffff.
E8601DXw. Format (p. 197) Adjusts a Coordinated Universal Time (UTC) datetime value
to the user’s local date and time. Then, writes the local date
and time by using the ISO 8601 datetime and time zone
extended notation yyyy-mm-ddThh:mm:ss+hh:mm.
E8601DZw. Format (p. 199) Writes datetime values for the zero meridian Coordinated
Universal Time (UTC) by using the ISO 8601 datetime and
time zone extended notation yyyy-mm-ddThh:mm:ss+00:00.
E8601LXw. Format (p. 201) Writes datetime values as local time by appending a time
zone offset difference between the local time and UTC,
using the ISO 8601 extended notation yyyy-mm-
ddThh:mm:ss+|–hh:mm.
MDYAMPMw.d Format (p. Writes datetime values in the form mm/dd/yy<yy> hh:mm
233) AM|PM. The year can be either two or four digits.
NLDATMw. Format (p. 280) Writes a SAS datetime value as a datetime that is
appropriate for the current SAS locale.
NLDATMAPw. Format (p. Wries a SAS datetime value as a datetime with a.m. or p.m.
281) that is appropriate for the current SAS locale.
NLDATMDTw. Format (p. Writes the SAS datetime value as the name of the month,
282) day of the month and year that is appropriate for the current
SAS locale.
NLDATMLw. Format (p. 284) Writes a SAS datetime value as a long representation of the
date that is appropriate for the current SAS locale.
NLDATMMw. Format (p. 285) Writes a SAS datetime value as a medium representation of
the date that is appropriate for the current SAS locale.
NLDATMMDw. Format (p. Writes the SAS datetime value as the name of the month
286) and the day of the month that is appropriate for the current
SAS locale.
NLDATMMNw. Format (p. Writes the SAS datetime value as the name of the month
290) that is appropriate for the current SAS locale.
NLDATMSw. Format (p. 292) Writes a SAS datetime value as the short representation of
the date that is appropriate for the current SAS locale.
Formats by Category 91
NLDATMTMw. Format (p. Writes the time portion of a SAS datetime value as a time of
293) day that is appropriate for the current SAS locale.
NLDATMTZw. Format (p. Writes the time portion of the SAS datetime value as the
294) time of day and time zone that is appropriate for the current
SAS locale.
NLDATMWw. Format (p. Writes SAS datetime values as the day of the week and the
295) datetime that is appropriate for the current SAS locale.
NLDATMWNw. Format (p. Writes a SAS datetime value as the day of the week that is
297) appropriate for the current SAS locale.
NLDATMWZw. Format (p. Writes SAS date values as day-of-week, datetime, and time
298) zone values that are appropriate.
NLDATMYMw. Format (p. Writes the SAS datetime value as the month and year that is
299) appropriate for the current SAS locale.
NLDATMYQw. Format (p. Writes the SAS datetime value as the quarter and the year
303) that is appropriate for the current SAS locale.
NLDATMYRw. Format (p. Writes the SAS datetime value as the year that is
308) appropriate for the current SAS locale.
NLDATMYWw. Format (p. Writes the SAS datetime value as the week number and the
309) year that is appropriate for the current SAS locale.
NLDATMZw. Format (p. 310) Writes SAS datetime values as datetime and time zone
values that are appropriate for the current SAS locale.
NLTIMAPw. Format (p. 415) Writes a SAS time value as a time value with a.m. or p.m.
that is appropriate for the current SAS locale.
NLTIMEw. Format (p. 416) Writes a SAS time value as a time value that is appropriate
for the current SAS locale.
TIMEAMPMw.d Format (p. Writes time and datetime values as hours, minutes, and
466) seconds in the form hh:mm:ss.ss with AM or PM.
TODw.d Format (p. 468) Writes SAS time values and the time portion of SAS
datetime values in the form hh:mm:ss.ss.
YYQZw. Format (p. 512) Writes SAS date values in the form <yy><qq>, the year
appears as 2 or 4 digits, and qq is the quarter of the year.
YYWEEKUw. Format (p. Writes a week number in decimal format by using the U
513) algorithm, excluding day-of-the-week information.
YYWEEKVw. Format (p. Writes a week number in decimal format by using the V
515) algorithm, excluding day-of-the-week information.
YYWEEKWw. Format (p. Writes a week number in decimal format by using the W
517) algorithm, excluding the day-of-week information.
92 Chapter 2 / Dictionary of Formats
ISO 8601 $N8601Bw.d Format (p. 113) Writes ISO 8601 duration, datetime, and interval forms by
using the basic notations PnYnMnDTnHnMnS and
yyyymmddThhmmss.
$N8601BAw.d Format (p. Writes ISO 8601 duration, datetime, and interval forms by
115) using the basic notations PyyyymmddThhmmss and
yyyymmddThhmmss.
$N8601Ew.d Format (p. 117) Writes ISO 8601 duration, datetime, and interval forms by
using the extended notations PnYnMnDTnHnMnS and yyyy-
mm-ddThh:mm:ss.
$N8601EAw.d Format (p. Writes ISO 8601 duration, datetime, and interval forms by
120) using the extended notations Pyyyy-mm-ddThh:mm:ss and
yyyy-mm-ddThh:mm:ss.
$N8601EHw.d Format (p. Writes ISO 8601 duration, datetime, and interval forms by
122) using the extended notations Pyyyy-mm-ddThh:mm:ss and
yyyy-mm-ddThh:mm:ss, using a hyphen (-) for omitted
components.
$N8601EXw.d Format (p. Writes ISO 8601 duration, datetime, and interval forms by
124) using the extended notations Pyyyy-mm-ddThh:mm:ss and
yyyy-mm-ddThh:mm:ss, using an x for each digit of an
omitted component.
$N8601Hw.d Format (p. 126) Writes ISO 8601 duration, datetime, and interval forms
PnYnMnDTnHnMnS and yyyy-mm-ddThh:mm:ss, dropping
omitted components in duration values and using a hyphen
(-) for omitted components in datetime values.
$N8601Xw.d Format (p. 128) Writes ISO 8601 duration, datetime, and interval forms
PnYnMnDTnHnMnS and yyyy-mm-ddThh:mm:ss, dropping
omitted components in duration values and using an x for
each digit of an omitted component in datetime values.
B8601DAw. Format (p. 146) Writes date values by using the ISO 8601 basic notation
yyyymmdd.
B8601DNw. Format (p. 148) Writes dates from datetime values by using the ISO 8601
basic notation yyyymmdd.
B8601DTw.d Format (p. 149) Writes datetime values by using the ISO 8601 basic notation
yyyymmddThhmmss<ffffff>.
B8601DXw. Format (p. 151) Adjusts a Coordinated Universal Time (UTC) datetime value
to the user’s local date and time. Then, writes the local date
and time by using the ISO 8601 datetime and time zone
basic notation yyyymmddThhmmss+hhmm.
B8601DZw. Format (p. 153) Writes datetime values for the zero meridian Coordinated
Universal Time (UTC) time by using the ISO 8601 datetime
and time zone basic notation yyyymmddThhmmss+0000.
B8601LXw. Format (p. 154) Writes datetime values as local time by appending a time
zone offset difference between the local time and UTC,
Formats by Category 93
B8601LZw. Format (p. 156) Writes time values as local time by appending a time zone
offset difference between the local time and UTC, using the
ISO 8601 basic time notation hhmmss+|–hhmm.
B8601TMw.d Format (p. 158) Writes time values by using the ISO 8601 basic notation
hhmmss<ffff>.
B8601TXw. Format (p. 159) Adjusts a Coordinated Universal Time (UTC) value to the
user’s local time. Then, writes the local time by using the
ISO 8601 basic time notation hhmmss+|-hhmm.
B8601TZw. Format (p. 161) Adjusts time values to the Coordinated Universal Time
(UTC) and writes the time values by using the ISO 8601
basic time notation hhmmss+|–hhmm.
E8601DAw. Format (p. 193) Writes date values by using the ISO 8601 extended notation
yyyy-mm-dd.
E8601DNw. Format (p. 194) Writes dates from SAS datetime values by using the ISO
8601 extended notation yyyy-mm-dd.
E8601DTw.d Format (p. 195) Writes datetime values by using the ISO 8601 extended
notation yyyy-mm-ddThh:mm:ss.ffffff.
E8601DXw. Format (p. 197) Adjusts a Coordinated Universal Time (UTC) datetime value
to the user’s local date and time. Then, writes the local date
and time by using the ISO 8601 datetime and time zone
extended notation yyyy-mm-ddThh:mm:ss+hh:mm.
E8601DZw. Format (p. 199) Writes datetime values for the zero meridian Coordinated
Universal Time (UTC) by using the ISO 8601 datetime and
time zone extended notation yyyy-mm-ddThh:mm:ss+00:00.
E8601LXw. Format (p. 201) Writes datetime values as local time by appending a time
zone offset difference between the local time and UTC,
using the ISO 8601 extended notation yyyy-mm-
ddThh:mm:ss+|–hh:mm.
E8601LZw. Format (p. 202) Writes time values as local time, appending the Coordinated
Universal Time (UTC) offset for the local SAS session, using
the ISO 8601 extended time notation hh:mm:ss+|–hh:mm.
E8601TMw.d Format (p. 204) Writes time values by using the ISO 8601 extended notation
hh:mm:ss.ffffff.
E8601TXw. Format (p. 206) Adjusts a Coordinated Universal Time (UTC) value to the
user’s local time. Then, writes the local time by using the
ISO 8601 extended time notation hh:mm:ss+|–hh:mm.
E8601TZw.d Format (p. 208) Adjusts time values to the Coordinated Universal Time
(UTC) and writes the time values by using the ISO 8601
extended notation hh:mm:ss.<fff>+|–hh:mm.
94 Chapter 2 / Dictionary of Formats
Numeric BESTw. Format (p. 141) SAS chooses the best notation.
BESTDw.p Format (p. 143) Prints numeric values, lining up decimal places for values of
similar magnitude, and prints integers without decimals.
COMMAw.d Format (p. 163) Writes numeric values with a comma that separates every
three digits and a period that separates the decimal fraction.
COMMAXw.d Format (p. Writes numeric values with a period that separates every
165) three digits and a comma that separates the decimal
fraction.
Dw.p Format (p. 166) Prints numeric values, possibly with a great range of values,
lining up decimal places for values of similar magnitude.
DOLLARw.d Format (p. 180) Writes numeric values with a leading dollar sign, a comma
that separates every three digits, and a period that
separates the decimal fraction.
DOLLARXw.d Format (p. Writes numeric values with a leading dollar sign, a period
181) that separates every three digits, and a comma that
separates the decimal fraction.
EUROw.d Format (p. 210) Writes numeric values with a leading euro symbol (E), a
comma that separates every three digits, and a period that
separates the decimal fraction.
EUROXw.d Format (p. 213) Writes numeric values with a leading euro symbol (E), a
period that separates every three digits, and a comma that
separates the decimal fraction.
Fw.d Format (p. 215) Rounds the value to the nearest number that fits in the
output field.
HEXw. Format (p. 220) Converts real binary (floating-point) values to hexadecimal
representation.
IBw.d Format (p. 225) Writes native integer binary (fixed-point) values, including
negative values.
IBRw.d Format (p. 227) Writes integer binary (fixed-point) values in Intel and DEC
formats.
NLBESTw. Format (p. 252) Writes the best numerical notation based on the locale.
NLMNIAEDw.d Format (p. Writes the monetary format of the international expression
310) for the United Arab Emirates.
NLMNIAUDw.d Format (p. Writes the monetary format of the international expression
312) for Australia.
NLMNIBGNw.d Format (p. Writes the monetary format of the international expression
313) for Bulgaria.
NLMNIBRLw.d Format (p. Writes the monetary format of the international expression
314) for Brazil.
NLMNICADw.d Format (p. Writes the monetary format of the international expression
315) for Canada.
NLMNICHFw.d Format (p. Writes the monetary format of the international expression
316) for Liechtenstein and Switzerland.
NLMNICNYw.d Format (p. Writes the monetary format of the international expression
317) for China.
NLMNICZKw.d Format (p. Writes the monetary format of the international expression
319) for the Czech Republic.
NLMNIDKKw.d Format (p. Writes the monetary format of the international expression
320) for Denmark, Faroe Island, and Greenland.
NLMNIEEKw.d Format (p. Writes the monetary format of the international expression
321) for Estonia.
NLMNIEGPw.d Format (p. Writes the monetary format of the international expression
322) for Egypt.
NLMNIEURw.d Format (p. Writes the monetary format of the international expression
323) for Austria, Belgium, Cyprus, Estonia, Finland, France,
Germany, Greece, Ireland, Italy, Latvia, Lithuania,
Luxembourg, Malta, the Netherlands, Portugal, Slovakia,
Slovenia, and Spain.
NLMNIGBPw.d Format (p. Writes the monetary format of the international expression
324) for the United Kingdom.
NLMNIHKDw.d Format (p. Writes the monetary format of the international expression
326) for Hong Kong.
NLMNIHRKw.d Format (p. Writes the monetary format of the international expression
327) for Croatia.
96 Chapter 2 / Dictionary of Formats
NLMNIHUFw.d Format (p. Writes the monetary format of the international expression
328) for Hungary.
NLMNIIDRw.d Format (p. Writes the monetary format of the international expression
329) for Indonesia.
NLMNIILSw.d Format (p. Writes the monetary format of the international expression
330) for Israel.
NLMNIINRw.d Format (p. Writes the monetary format of the international expression
331) for India.
NLMNIJPYw.d Format (p. Writes the monetary format of the international expression
333) for Japan.
NLMNIKRWw.d Format (p. Writes the monetary format of the international expression
334) for South Korea.
NLMNILTLw.d Format (p. Writes the monetary format of the international expression
335) for Lithuania.
NLMNILVLw.d Format (p. Writes the monetary format of the international expression
336) for Latvia.
NLMNIMOPw.d Format (p. Writes the monetary format of the international expression
337) for Macau.
NLMNIMXNw.d Format (p. Writes the monetary format of the international expression
338) for Mexico.
NLMNIMYRw.d Format (p. Writes the monetary format of the international expression
340) for Malaysia.
NLMNINOKw.d Format (p. Writes the monetary format of the international expression
341) for Norway.
NLMNINZDw.d Format (p. Writes the monetary format of the international expression
342) for New Zealand.
NLMNIPLNw.d Format (p. Writes the monetary format of the international expression
343) for Poland.
NLMNIRUBw.d Format (p. Writes the monetary format of the international expression
344) for Russia.
NLMNISEKw.d Format (p. Writes the monetary format of the international expression
345) for Sweden.
NLMNISGDw.d Format (p. Writes the monetary format of the international expression
347) for Singapore.
NLMNITHBw.d Format (p. Writes the monetary format of the international expression
348) for Thailand.
Formats by Category 97
NLMNITRYw.d Format (p. Writes the monetary format of the international expression
349) for Turkey.
NLMNITWDw.d Format (p. Writes the monetary format of the international expression
350) for Taiwan.
NLMNIUSDw.d Format (p. Writes the monetary format of the international expression
351) for Puerto Rico and the United States.
NLMNIZARw.d Format (p. Writes the monetary format of the international expression
352) for South Africa.
NLMNLAEDx.d Format (p. Writes the monetary format of the local expression for the
354) United Arab Emirates.
NLMNLAUDw.d Format (p. Writes the monetary format of the local expression for
355) Australia.
NLMNLBGNw.d Format (p. Writes the monetary format of the local expression for
356) Bulgaria.
NLMNLBRLw.d Format (p. Writes the monetary format of the local expression for Brazil.
357)
NLMNLCADw.d Format (p. Writes the monetary format of the local expression for
358) Canada.
NLMNLCHFw.d Format (p. Writes the monetary format of the local expression for
359) Liechtenstein and Switzerland.
NLMNLCNYw.d Format (p. Writes the monetary format of the local expression for
361) China.
NLMNLCZKw.d Format (p. Writes the monetary format of the local expression for the
362) Czech Republic.
NLMNLDKKw.d Format (p. Writes the monetary format of the local expression for
363) Denmark, Faroe Island, and Greenland.
NLMNLEEKw.d Format (p. Writes the monetary format of the local expression for
364) Estonia.
NLMNLEGPw.d Format (p. Writes the monetary format of the local expression for
365) Egypt.
NLMNLEURw.d Format (p. Writes the monetary format of the local expression for
366) Austria, Belgium, Cyprus, Estonia, Finland, France,
Germany, Greece, Ireland, Italy, Latvia, Lithuania,
Luxembourg, Malta, the Netherlands, Portugal, Slovakia,
Slovenia, and Spain.
NLMNLGBPw.d Format (p. Writes the monetary format of the local expression for the
368) United Kingdom.
98 Chapter 2 / Dictionary of Formats
NLMNLHKDw.d Format (p. Writes the monetary format of the local expression for Hong
369) Kong.
NLMNLHRKw.d Format (p. Writes the monetary format of the local expression for
370) Croatia.
NLMNLHUFw.d Format (p. Writes the monetary format of the local expression for
371) Hungary.
NLMNLIDRw.d Format (p. Writes the monetary format of the local expression for
372) Indonesia.
NLMNLILSw.d Format (p. Writes the monetary format of the local expression for Israel.
373)
NLMNLINRw.d Format (p. Writes the monetary format of the local expression for India.
375)
NLMNLJPYw.d Format (p. Writes the monetary format of the international expression
376) for Japan.
NLMNLKRWw.d Format (p. Writes the monetary format of the local expression for South
377) Korea.
NLMNLLTLw.d Format (p. Writes the monetary format of the local expression for
378) Lithuania.
NLMNLLVLw.d Format (p. Writes the monetary format of the local expression for
379) Latvia.
NLMNLMOPw.d Format (p. Writes the monetary format of the local expression for
380) Macau.
NLMNLMXNw.d Format (p. Writes the monetary format of the local expression for
382) Mexico.
NLMNLMYRw.d Format (p. Writes the monetary format of the local expression for
383) Malaysia.
NLMNLNOKw.d Format (p. Writes the monetary format of the local expression for
384) Norway.
NLMNLNZDw.d Format (p. Writes the monetary format of the local expression for New
385) Zealand.
NLMNLPLNw.d Format (p. Writes the monetary format of the local expression for
386) Poland.
NLMNLRUBw.d Format (p. Writes the monetary format of the local expression for
387) Russia.
NLMNLSEKw.d Format (p. Writes the monetary format of the local expression for
389) Sweden.
Formats by Category 99
NLMNLSGDw.d Format (p. Writes the monetary format of the local expression for
390) Singapore.
NLMNLTHBw.d Format (p. Writes the monetary format of the local expression for
391) Thailand.
NLMNLTRYw.d Format (p. Writes the monetary format of the local expression for
392) Turkey.
NLMNLTWDw.d Format (p. Writes the monetary format of the local expression for
393) Taiwan.
NLMNLUSDw.d Format (p. Writes the monetary format of the local expression for
394) Puerto Rico and the United States.
NLMNLZARw.d Format (p. Writes the monetary format of the local expression for South
396) Africa.
NLMNYw.d Format (p. 397) Writes the monetary format of the local expression that is
appropriate for the current SAS locale.
NLMNYIw.d Format (p. 398) Writes the monetary format of the international expression
that is appropriate for the current SAS locale.
NLNUMw.d Format (p. 400) Writes the numeric format of the local expression that is
appropriate for the current SAS locale.
NLNUMIw.d Format (p. 402) Writes the numeric format of the international expression
that is appropriate for the current SAS locale.
NLPCTw.d Format (p. 403) Writes percentage data of the local expression that is
appropriate for the current SAS locale.
NLPCTIw.d Format (p. 405) Writes percentage data of the international expression that
is appropriate for the current SAS locale.
NLPCTNw.d Format (p. 407) Writes percentages, using a minus sign for negative values.
NLPVALUEw.d Format (p. Writes p-values of the local expression that is appropriate
409) for the current SAS locale.
NLSTRMONw.d Format (p. Writes the month name that is appropriate for the current
410) SAS locale.
NUMXw.d Format (p. 417) Writes numeric values with a comma in place of the decimal
point.
100 Chapter 2 / Dictionary of Formats
PERCENTNw.d Format (p. Produces percentages, using a minus sign for negative
429) values.
PIBw.d Format (p. 431) Writes positive integer binary (fixed-point) values.
PIBRw.d Format (p. 433) Writes positive integer binary (fixed-point) values in Intel and
DEC formats.
PKw.d Format (p. 435) Writes data in unsigned packed decimal format.
RBw.d Format (p. 440) Writes real binary data (floating-point) in real binary format.
S370FFw.d Format (p. 443) Writes native standard numeric data in IBM mainframe
format.
S370FIBw.d Format (p. 444) Writes integer binary (fixed-point) values, including negative
values, in IBM mainframe format.
S370FIBUw.d Format (p. Writes unsigned integer binary (fixed-point) values in IBM
446) mainframe format.
S370FPDw.d Format (p. 448) Writes packed decimal data in IBM mainframe format.
S370FPDUw.d Format (p. Writes unsigned packed decimal data in IBM mainframe
450) format.
S370FPIBw.d Format (p. Writes positive integer binary (fixed-point) values in IBM
451) mainframe format.
S370FRBw.d Format (p. 453) Writes real binary (floating-point) data in IBM mainframe
format.
S370FZDw.d Format (p. 455) Writes zoned decimal data in IBM mainframe format.
S370FZDLw.d Format (p. Writes zoned decimal leading-sign data in IBM mainframe
456) format.
S370FZDSw.d Format (p. Writes zoned decimal separate leading-sign data in IBM
458) mainframe format.
Formats by Category 101
S370FZDTw.d Format (p. Writes zoned decimal separate trailing-sign data in IBM
459) mainframe format.
S370FZDUw.d Format (p. Writes unsigned zoned decimal data in IBM mainframe
461) format.
VAXRBw.d Format (p. 471) Writes real binary (floating-point) data in VMS format.
VMSZNw.d Format (p. 472) Generates VMS and MicroFocus COBOL zoned numeric
data.
w.d Format (p. 474) Writes standard numeric data one digit per byte.
WORDFw. Format (p. 491) Writes numeric values as words with fractions that are
shown numerically.
YYMONw. Format (p. 503) Writes date values in the form yymmm or yyyymmm.
YYQRxw. Format (p. 510) Writes date values in the form <yy>yyqr or <yy>yy-qr, where
the x in the format name is a character that represents the
special character. The special character separates the year
and the quarter or the year. The special character can be a
hyphen (-), period (.), blank character, slash (/), colon (:), or
no separator. The year can be either two or four digits, and
qr is the quarter of the year expressed in Roman numerals.
Zw.d Format (p. 519) Writes standard numeric data with leading 0s.
ZDw.d Format (p. 520) Writes numeric data in zoned decimal format.
Time B8601TMw.d Format (p. 158) Writes time values by using the ISO 8601 basic notation
hhmmss<ffff>.
B8601TXw. Format (p. 159) Adjusts a Coordinated Universal Time (UTC) value to the
user’s local time. Then, writes the local time by using the
ISO 8601 basic time notation hhmmss+|-hhmm.
B8601TZw. Format (p. 161) Adjusts time values to the Coordinated Universal Time
(UTC) and writes the time values by using the ISO 8601
basic time notation hhmmss+|–hhmm.
E8601LZw. Format (p. 202) Writes time values as local time, appending the Coordinated
Universal Time (UTC) offset for the local SAS session, using
the ISO 8601 extended time notation hh:mm:ss+|–hh:mm.
E8601TMw.d Format (p. 204) Writes time values by using the ISO 8601 extended notation
hh:mm:ss.ffffff.
102 Chapter 2 / Dictionary of Formats
E8601TXw. Format (p. 206) Adjusts a Coordinated Universal Time (UTC) value to the
user’s local time. Then, writes the local time by using the
ISO 8601 extended time notation hh:mm:ss+|–hh:mm.
E8601TZw.d Format (p. 208) Adjusts time values to the Coordinated Universal Time
(UTC) and writes the time values by using the ISO 8601
extended notation hh:mm:ss.<fff>+|–hh:mm.
HHMMw.d Format (p. 221) Writes time values as hours and minutes in the form hh:mm.
HOURw.d Format (p. 224) Writes time values as hours and decimal fractions of hours.
MMSSw.d Format (p. 240) Writes time values as the number of minutes and seconds
since midnight.
NLDATMTMw. Format (p. Writes the time portion of a SAS datetime value as a time of
293) day that is appropriate for the current SAS locale.
NLDATMTZw. Format (p. Writes the time portion of the SAS datetime value as the
294) time of day and time zone that is appropriate for the current
SAS locale.
NLTIMAPw. Format (p. 415) Writes a SAS time value as a time value with a.m. or p.m.
that is appropriate for the current SAS locale.
NLTIMEw. Format (p. 416) Writes a SAS time value as a time value that is appropriate
for the current SAS locale.
TIMEw.d Format (p. 463) Writes time values as hours, minutes, and seconds in the
form hh:mm:ss.ss.
TIMEAMPMw.d Format (p. Writes time and datetime values as hours, minutes, and
466) seconds in the form hh:mm:ss.ss with AM or PM.
Dictionary
$ASCIIw. Format
Converts native format character data to ASCII representation.
Category: Character
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
$ASCIIw. Format 103
Syntax
$ASCIIw.
Syntax Description
w
specifies the width of the output field.
Default 1
Range 1–32767
Details
If ASCII is the native format, no conversion occurs.
Comparisons
n On EBCDIC systems, $ASCIIw. converts EBCDIC character data to ASCIIw.
Example
data one;
input x $;
datalines;
abc
ABC
()*
;
run;
data two;
set one;
put x $ascii3.;
run;
SAS writes the following results to the log:
abc
ABC
()*
104 Chapter 2 / Dictionary of Formats
$BASE64Xw. Format
Converts character data into ASCII text by using Base 64 encoding.
Categories: CAS
Character
Alignment: Left
Syntax
$BASE64Xw.
Syntax Description
w
specifies the width of the output field.
You can use the following formula to determine the width:
format-width=(variable-length+2)/3*4
When the variable-length+2 is divided by 3, the results are truncated to an
integer and multiplied by 4. For example, if a variable length is 48, the width
calculation is (48+2)/3*4=64.
If the format width is too small, the value is not converted. No message is written
to the SAS log.
Default 1
Range 1–32767
Details
Base 64 is an industry encoding method whose encoded characters are determined
by using a positional scheme that uses only ASCII characters. Several Base 64
encoding schemes have been defined by the industry for specific uses, such as
email or content masking. SAS maps positions 0–61 to the characters A–Z, a–z,
and 0–9. Position 62 maps to the character +, and position 63 maps to the
character /.
Here are some uses of Base 64 encoding:
n embed binary data in an XML file
n encode passwords
n encode URLs
$BINARYw. Format 105
If the encoded results contain the '=' character, it indicates that the results have
been padded with zero bits. In order for the encoded characters to be decoded, the
'=' must be included in the value to be decoded.
Example
data one;
input x :$30.;
datalines;
FCA01A7993BC
MyPassword
www.mydomain.com/myhiddenURL
;
run;
data two;
set one;
put x $base64x64.;
run;
SAS writes the following results to the log:
RkNBMDFBNzk5M0JDICAgICAgICAgICAgICAgICAg
TXlQYXNzd29yZCAgICAgICAgICAgICAgICAgICAg
d3d3Lm15ZG9tYWluLmNvbS9teWhpZGRlblVSTCAg
See Also
n The LIBNAME statement option “LIBNAME Statement: XMLV2 and XML
Engines” in SAS XMLV2 and XML LIBNAME Engines: User’s Guide
Informats:
n “$BASE64Xw. Informat” on page 561
$BINARYw. Format
Converts character data to binary representation.
Categories: CAS
Character
Alignment: Left
106 Chapter 2 / Dictionary of Formats
Syntax
$BINARYw.
Syntax Description
w
specifies the width of the output field.
Default The default width is calculated based on the length of the variable to be
printed.
Range 1–32767
Comparisons
The $BINARYw. format converts character values to binary representation. The
BINARYw. format converts numeric values to binary representation.
There is not a blank space between the A and B in the code example, or between
their binary representations in the output.
$CHARw. Format
Writes standard character data.
Categories: CAS
Character
Alignment: Left
$CHARw. Format 107
Syntax
$CHARw.
Syntax Description
w
specifies the width of the output field.
Default 8 if the length of the variable is undefined; otherwise, the length of the
variable
Range 1–32767
Comparisons
n The $CHARw. format is not identical to the $w. format. The $CHARw. format
does not trim trailing blanks. The $w. format trims trailing blanks.
n The $CHARw. and $w. formats do not trim leading blanks. To trim leading
blanks, use the LEFT function to left-align character data. Alternatively, use the
PUT statement with the colon (:) format modifier and the format of your choice to
produce list output.
n Use the following table to compare the SAS format $CHAR8. with notation in
other programming languages:
Language Notation
SAS $CHAR8.
C char [8]
Example:
data one;
length x $5;
input x $5. y;
put x $char. y;
datalines;
AB 123
;
run;
108 Chapter 2 / Dictionary of Formats
The preceding example specifies a length value. The example then uses the value
when it writes this character data to the SAS log.
AB 123
$CSTR Format
Looks for the last non-blank character of a character argument and passes a copy of the string with a null
terminator after the last non-blank character.
Categories: CAS
Character
Syntax
$CSTRw.
Required Argument
w
specifies the width of the output field.
Default 1
Range 1–32767
Details
Use the $CSTRw. format to pass a character argument as a null-terminated string.
$CSTR looks for the last non-blank character of a character argument and passes a
copy of the string with a null terminator after the last non-blank character.
Example
data _null_;
name='XYZ';
put name $cstr10.;
run;
----+----1
$EBCDICw. Format 109
$EBCDICw. Format
Converts native format character data to EBCDIC representation.
Category: Character
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Note: UTF-8 is the only supported session encoding. $EBCDIC format works only for 7-bit
ASCII characters.
Syntax
$EBCDICw.
Syntax Description
w
specifies the width of the output field.
Default 1
Range 1–32767
Details
If EBCDIC is the native format, no conversion occurs.
On ASCII systems, the $EBCDICw. format is based on the default encoding value of
the LOCALE= option that is specified when SAS starts. For example, if the locale
was set to en_US locale, the default encoding that is used by the $EBCDICw.
format is Open_ed-1047. If the locale is de_DE (German_Germany), the default
encoding that is used by the $EBCDICw. format is Open_ed–1141. For a list of
locales and encoding values, see “Default Values for DFLANG, DATESTYLE, and
PAPERSIZE System Options Based on the LOCALE= System Option” in SAS
National Language Support (NLS): Reference Guide.
110 Chapter 2 / Dictionary of Formats
You can specify the translation table that is used to map characters between
EBCDIC and ASCII by using the MAPEBCDIC2ASCII system option. For more
information, see “MAPEBCDIC2ASCII= System Option” in SAS National Language
Support (NLS): Reference Guide.
Comparisons
n On ASCII systems, $EBCDICw. converts ASCII character data to EBCDIC.
n On all other systems, $EBCDICw. behaves like the $CHARw. format.
Example
data one;
input x $;
datalines;
ABC
{ä}
[@]
;
run;
data two;
set one;
y=put(x,$ebcdic3.);
put y $HEX6.;
run;
Table 2.1 Output Locale Values for American English, French, and German
$HEXw. Format
Converts character data to hexadecimal representation.
$HEXw. Format 111
Categories: CAS
Character
Alignment: Left
See: “$HEX Format: UNIX” in SAS Companion for UNIX Environments
“$HEXw. Format: Windows” in SAS Companion for Windows
Syntax
$HEXw.
Syntax Description
w
specifies the width of the output field.
Default The default width is calculated based on the length of the variable to be
printed.
Range 1–32767
Tips To ensure that SAS writes the full hexadecimal equivalent of your data,
make w twice the length of the variable or field that you want to
represent.
If w is greater than twice the length of the variable that you want to
represent, $HEXw. pads it with blanks.
Details
The $HEXw. format converts each character to two hexadecimal characters. Each
blank counts as one character, including trailing blanks.
Comparisons
The HEXw. format converts real binary numbers to their hexadecimal equivalent.
Example
data one;
x='AB';
put x $hex4.;
run;
112 Chapter 2 / Dictionary of Formats
EBCDIC ASCII
----+----1 ----+----1
AB C1C2 4142
$MSGCASEw. Format
Writes character data in uppercase when the MSGCASE system option is in effect.
Category: Character
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
$MSGCASEw.
Syntax Description
w
specifies the width of the output field.
Default 1, if the length of the variable is undefined. Otherwise, the default is the
length of the variable.
Range 1–32767
Details
When the MSGCASE system option is in effect, all notes, warnings, and error
messages that SAS generates appear in uppercase. Otherwise, all notes, warnings,
and error messages appear in mixed case. You specify the MSGCASE system
option in the configuration file or during the SAS invocation.
Example
data one;
x='sas';
$N8601Bw.d Format 113
put x $msgcase.;
run;
sas SAS
See Also
System Options:
n “MSGCASE System Option: UNIX” in SAS Companion for UNIX Environments
n “MSGCASE System Option: Windows” in SAS Companion for Windows
n “MSGCASE System Option: z/OS” in SAS Companion for z/OS
$N8601Bw.d Format
Writes ISO 8601 duration, datetime, and interval forms by using the basic notations PnYnMnDTnHnMnS
and yyyymmddThhmmss.
Categories: Date and Time
ISO 8601
Alignment: Left
Restrictions: This format is not supported in a DATA step that runs in CAS.
UTC time zone offset values are not supported.
Values greater than 12 are not supported.
Supports: ISO 8601 Element 5.4.4, complete representation
Syntax
$N8601Bw.d
Syntax Description
w
specifies the width of the output field.
Default 50
Range 1–200
114 Chapter 2 / Dictionary of Formats
d
specifies the number of digits to the right of the lowest-order component. This
argument is optional.
Default 0
Range 0–6
Details
The $N8601B format writes ISO 8601 duration, datetime, and interval values as
character data for the following basic notations:
n PnYnMnDTnHnMnS
n yyyymmddThhmmss
n PnYnMnDTnHnMnS/yyyymmddThhmmss
n yyyymmddThhmmssT/PnYnMnDTnHnMnS
n p00020304T05.335
Note: Using a month value that is greater than 12 with a datetime value causes an
error. For example, the value 20181415T000000/2018-09-15T00:00:00 causes an
error because the value for the month is 14.
Examples
1 X is a duration of 10 weeks.
2 Y is a datetime value.
$N8601BAw.d Format 115
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
$N8601BAw.d Format
Writes ISO 8601 duration, datetime, and interval forms by using the basic notations PyyyymmddThhmmss
and yyyymmddThhmmss.
Categories: Date and Time
ISO 8601
Alignment: Left
Restrictions: This format is not supported in a DATA step that runs in CAS.
UTC time zone offset values are not supported.
Supports: IS0 8601 Element 5.5.4.2, alternative format
116 Chapter 2 / Dictionary of Formats
Syntax
$N8601BAw.d
Syntax Description
w
specifies the width of the output field.
Default 50
Range 1–200
d
specifies the number of digits to the right of the lowest-order component. This
argument is optional.
Default 0
Range 0–6
Details
The $N8601BA format writes ISO 8601 duration, datetime, and interval values as
character data for the following basic notations:
n PyyyymmddThhmmss
n yyyymmddThhmmss
n PyyyymmddThhmmss/yyyymmddThhmmss
n yyyymmddThhmmss/PyyyymmddThhmmss
n 00020304T05.335
Examples
1 X is a duration of 10 weeks.
2 Y is a datetime value.
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
$N8601Ew.d Format
Writes ISO 8601 duration, datetime, and interval forms by using the extended notations
PnYnMnDTnHnMnS and yyyy-mm-ddThh:mm:ss.
Categories: Date and Time
ISO 8601
Alignment: Left
118 Chapter 2 / Dictionary of Formats
Restrictions: This format is not supported in a DATA step that runs in CAS.
UTC time zone offset values are not supported.
Supports: ISO 8601 Element 5.4.4, complete representation
Syntax
$N8601Ew.d
Syntax Description
w
specifies the width of the output field.
Default 50
Range 1–200
d
specifies the number of digits to the right of the lowest-order component. This
argument is optional.
Default 0
Range 0–6
Details
The $N8601E format writes ISO 8601 duration, datetime, and interval values as
character data for the following basic notations:
n PnYnMnDTnHnMnS
n yyyy-mm-ddThh:mm:ss
n PnYnMnDTnHnMnS/yyyy-mm-ddThh:mm:ss
n yyyy-mm-ddThh:mm:ssT/PnYnMnDTnHnMnS
n p0002–03–04T05.335
$N8601Ew.d Format 119
Examples
1 X is a duration of 10 weeks.
2 Y is a datetime value.
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
120 Chapter 2 / Dictionary of Formats
$N8601EAw.d Format
Writes ISO 8601 duration, datetime, and interval forms by using the extended notations Pyyyy-mm-
ddThh:mm:ss and yyyy-mm-ddThh:mm:ss.
Categories: Date and Time
ISO 8601
Alignment: Left
Restrictions: This format is not supported in a DATA step that runs in CAS.
UTC time zone offset values are not supported.
Supports: ISO 8601 Element 5.4.4, complete representation
Syntax
$N8601EAw.d
Syntax Description
w
specifies the width of the output field.
Default 50
Range 1–200
d
specifies the number of digits to the right of the lowest-order component. This
argument is optional.
Default 0
Range 0–6
Details
The $N8601EA format writes ISO 8601 duration, datetime, and interval values as
character data for the following basic notations:
n Pyyyy-mm-ddThh:mm:ss
n yyyy-mm-ddThh:mm:ss
n Pyyyy-mm-ddThh:mm:ss/yyyy-mm-ddThh:mm:ss
$N8601EAw.d Format 121
n yyyy-mm-ddThh:mm:ss/Pyyyy-mm-ddThh:mm:ss
n 0002–03–04T05.335
Examples
1 X is a duration of 10 weeks.
2 Y is a datetime value.
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
$N8601EHw.d Format
Writes ISO 8601 duration, datetime, and interval forms by using the extended notations Pyyyy-mm-
ddThh:mm:ss and yyyy-mm-ddThh:mm:ss, using a hyphen (-) for omitted components.
Categories: Date and Time
ISO 8601
Restrictions: This format is not supported in a DATA step that runs in CAS.
UTC time zone offset values are not supported.
Supports: ISO 8601 Element 5.4.4, complete representation
Syntax
$N8601EHw.d
Syntax Description
w
specifies the width of the output field.
Default 50
Range 1–200
d
specifies the number of digits to the right of the lowest-order component. This
argument is optional.
Default 0
Range 0–6
Details
The $N8601EH format writes ISO 8601 duration, datetime, and interval values as
character data, using a hyphen (-) to represent omitted components, for the
following extended notations:
$N8601EHw.d Format 123
n Pyyyy-mm-ddThh:mm:ss
n yyyy-mm-ddThh:mm:ss
n Pyyyy-mm-ddThh:mm:ss/yyyy-mm-ddThh:mm:ss
n yyyy-mm-ddThh:mm:ss/Pyyyy-mm-ddThh:mm:ss
n yyyy-mm-ddThh:mm:ss/yyyy-mm-ddThh:mm:ss
Omitted datetime components are always displayed; they are never truncated.
Examples
1 X is a duration of 10 weeks.
2 Y is a datetime value.
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
$N8601EXw.d Format
Writes ISO 8601 duration, datetime, and interval forms by using the extended notations Pyyyy-mm-
ddThh:mm:ss and yyyy-mm-ddThh:mm:ss, using an x for each digit of an omitted component.
Categories: Date and Time
ISO 8601
Alignment: Left
Restrictions: This format is not supported in a DATA step that runs in CAS.
UTC time zone offset values are not supported.
Supports: ISO 8601 Elements 5.5.3, 5.5.4.1, and 5.5.4.2
Syntax
$N8601EXw.d
Syntax Description
w
specifies the width of the output field.
Default 50
Range 1–200
d
specifies the number of digits to the right of the lowest-order component. This
argument is optional.
Default 0
Range 0–6
$N8601EXw.d Format 125
Details
The $N8601EX format writes ISO 8601 duration, datetime, and interval values as
character data, using a hyphen (-) to represent omitted components, for the
following extended notations:
n Pyyyy-mm-ddThh:mm:ss
n yyyy-mm-ddThh:mm:ss
n Pyyyy-mm-ddThh:mm:ss/yyyy-mm-ddThh:mm:ss
n yyyy-mm-ddThh:mm:ss/Pyyyy-mm-ddThh:mm:ss
n yyyy-mm-ddThh:mm:ss/yyyy-mm-ddThh:mm:ss
Omitted datetime components are always displayed; they are never truncated.
Examples
1 X is a duration of 10 weeks.
2 Y is a datetime value.
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
$N8601Hw.d Format
Writes ISO 8601 duration, datetime, and interval forms PnYnMnDTnHnMnS and yyyy-mm-ddThh:mm:ss,
dropping omitted components in duration values and using a hyphen (-) for omitted components in
datetime values.
Categories: Date and Time
ISO 8601
Alignment: Left
Restrictions: This format is not supported in a DATA step that runs in CAS.
UTC time zone offset values are not supported.
Supports: ISO 8601 Elements 5.5.3, 5.5.4.1, and 5.5.4.2
Syntax
$N8601Hw.d
Syntax Description
w
specifies the width of the output field.
Default 50
Range 1–200
d
specifies the number of digits to the right of the lowest-order component. This
argument is optional.
Default 0
Range 0–6
Details
The $N8601H format writes ISO 8601 durations, intervals, and datetimes in the
following forms, omitting components in the PnYnMnDTnHnMnS form and using a
hyphen (-) to represent omitted components in the datetime form:
n PnYnMnDTnHnMnS
n yyyy-mm-ddThh:mm:ss
n PnYnMnDTnHnMnS/yyyy-mm-ddThh:mm:ss
n yyyy-mm-ddThh:mm:ssT/PnYnMnDTnHnMnS
n yyyy-mm-ddThh:mm:ss/yyyy-mm-ddThh:mm:ss
Omitted datetime components are always displayed; they are never truncated.
Examples
1 X is a duration of 10 weeks.
2 Y is a datetime value.
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
$N8601Xw.d Format
Writes ISO 8601 duration, datetime, and interval forms PnYnMnDTnHnMnS and yyyy-mm-ddThh:mm:ss,
dropping omitted components in duration values and using an x for each digit of an omitted component in
datetime values.
Categories: Date and Time
ISO 8601
Alignment: Left
Restrictions: This format is not supported in a DATA step that runs in CAS.
UTC time zone offset values are not supported.
Supports: ISO 8601 Elements 5.5.3, 5.5.4.1, and 5.5.4.2
Syntax
$N8601Xw.d
$N8601Xw.d Format 129
Syntax Description
w
specifies the width of the output field.
Default 50
Range 1–200
d
specifies the number of digits to the right of the lowest-order component. This
argument is optional.
Default 0
Range 0–6
Details
The $N8601X format writes ISO 8601 durations, intervals, and datetimes in the
following forms, omitting components in the PnYnMnDTnHnMnS form and using an
x to represent omitted components in the datetime form:
n PnYnMnDTnHnMnS
n yyyy-mm-ddThh:mm:ss
n PnYnMnDTnHnMnS/yyyy-mm-ddThh:mm:ss
n yyyy-mm-ddThh:mm:ssT/PnYnMnDTnHnMnS
n yyyy-mm-ddThh:mm:ss/yyyy-mm-ddThh:mm:ss
Omitted datetime components are always displayed; they are never truncated.
Example
This example writes a datetime value that represents June 5, 2018, 10 hours, 15
minutes, and 20 seconds. This newly computed datetime is a character variable, as
the LENGTH statement indicates.
data one;
input y mo d h min s;
length dt $16;
call is8601_convert('dt6','start',y,mo,d,h,min,s,dt);
put dt $n8601x.;
datalines;
2018 6 . 10 15 20
2018 . 5 10 15 20
;
run;
130 Chapter 2 / Dictionary of Formats
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
$OCTALw. Format
Converts character data to octal representation.
Categories: CAS
Character
Alignment: Left
Syntax
$OCTALw.
Syntax Description
w
specifies the width of the output field.
Default The default width is calculated based on the length of the variable to be
printed.
Range 1–32767
Comparisons
The $OCTALw. format converts character values to the octal representation of their
character codes. The OCTALw. format converts numeric values to octal
representation.
Example
The following example shows ASCII output when you use the $OCTALw. format.
data _null_;
infile datalines truncover;
input item $5.;
put item $octal15.;
datalines;
art
rice
bank
;
run;
SAS writes the following results to the log.
141162164040040
162151143145040
142141156153040
$QUOTEw. Format
Writes data values that are enclosed in double quotation marks.
Categories: CAS
Character
Alignment: Left
Syntax
$QUOTEw.
Syntax Description
w
specifies the width of the output field.
132 Chapter 2 / Dictionary of Formats
Default 2, if the length of the variable is undefined. Otherwise, the default is the
length of the variable plus 2
Range 1–32767
Tip Make w wide enough to include the left and right quotation marks.
Details
This list describes the output that SAS produces when you use the $QUOTEw.
format. For examples of these items, see the examples that follow the list.
n If your data value is not enclosed in quotation marks, SAS encloses the output in
double quotation marks.
n If your data value is not enclosed in quotation marks, but the value contains a
single quotation mark, SAS behaves in one of these ways:
o encloses the data value in double quotation marks
o leaves the single quotation mark
n If your data value begins and ends with single quotation marks, and the value
contains double quotation marks, SAS behaves in one of these ways:
o encloses the data value in double quotation marks
o duplicates the double quotation marks that are found in the data value
o leaves the single quotation marks
n If your data value begins and ends with single quotation marks, and the value
contains two single contiguous quotation marks, SAS behaves in one of these
ways:
o encloses the value in double quotation marks
o leaves the single quotation marks
n If your data value begins and ends with single quotation marks, and contains
both double quotation marks and single, contiguous quotation marks, SAS
behaves in one of these ways:
o encloses the value in double quotation marks
o duplicates the double quotation marks that are found in the data value
o leaves the single quotation marks
n If the length of the target field is not large enough to contain the string and its
quotation marks, SAS returns as much of the quoted string as fits in the field.
The result contains leading and trailing quotation marks, and the value is
truncated to ensure enough room in the field for the quotation marks. For
example, if the specified value is ABCDE and you specify $QUOTE5., the DE in
the value is truncated and the result is "ABC".
Example
data test;
input original $19.;
format original $quote20.;
datalines;
SAS
SAS's
'ad"verb"'
'ad''verb'
'"ad"''"verb"'
deoxyribonucleotide
;
run;
proc print noobs; run;
----+----1----+----2
SAS "SAS"
SAS's "SAS's"
'ad"verb"' "'ad""verb""'"
'ad''verb' "'ad''verb'"
'"ad"''"verb"' ----+----1----+----2
"'""ad""''""verb""'"
deoxyribonucleotide "deoxyribonucleotid" 1
1 deoxyribonucleotide is 19 characters. When SAS adds the quotation marks, the length of the string is
21 characters. SAS truncates the letter e at the end of the text to accommodate the quotation marks.
$REVERJw. Format
Writes character data in reverse order and preserves blanks.
Categories: CAS
Character
Alignment: Right
134 Chapter 2 / Dictionary of Formats
Syntax
$REVERJw.
Syntax Description
w
specifies the width of the output field.
Range 1–32767
Comparisons
The $REVERJw. format is similar to the $REVERSw. format, except that
$REVERSw. left-aligns the result by trimming all leading blanks.
Example
data _null_;
x='ABCD ';
put x $reverj7.;
y=' ABCD';
put y $reverj7.;
run;
----+----1
$REVERSw. Format
Writes character data in reverse order and left-aligns
Categories: CAS
Character
Alignment: Left
$UPCASEw. Format 135
Syntax
$REVERSw.
Syntax Description
w
specifies the width of the output field.
Range 1–32767
Comparisons
The $REVERSw. format is similar to the $REVERJw. format, except that
$REVERJw. does not left-align the result.
Example
data _null_;
x='ABCD ';
put x $revers7.;
y=' ABCD';
put y $revers7.;
run;
----+----1
$UPCASEw. Format
Converts character data to uppercase.
Categories: CAS
Character
Alignment: Left
136 Chapter 2 / Dictionary of Formats
Syntax
$UPCASEw.
Syntax Description
w
specifies the width of the output field.
Default 8, if the length of the variable is undefined. Otherwise, the default is the
length of the variable.
Range 1–32767
Details
Special characters, such as hyphens and other symbols, are not altered.
Example
data one;
name='coxe-ryan';
put name $upcase9.;
run;
----+----1
coxe-ryan COXE-RYAN
$UUIDw. Format
Converts character data to the Universally Unique Identifier (UUID) format.
Categories: CAS
Character
Alignment: Left
$VARYINGw. Format 137
Syntax
$UUIDw.
Arguments
w
specifies the width of the output field.
Range 1–200
Details
The value to be formatted must be a 16-byte binary value. The $UUID format
displays the binary data with hexadecimal characters and hyphens as delimiters. If
you specify the value in a format other than hexadecimal, the returned UUID is the
hexadecimal representation of the original characters.
Note: In this example, the binary value is set via a hexadecimal literal.
Example
data _null_;
length x $32 y $36;
x='1548611fb8cb6a47a721a6fd284e74f2'x;
y=put(x, $uuid36.);
put y;
run;
Value of x Result
1548611fb8cb6a47a721a6fd284e74f2 1548611f-b8cb-6a47-a721-a6fd284e74f2
$VARYINGw. Format
Writes character data of varying length.
Valid in: DATA step
Category: Character
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
138 Chapter 2 / Dictionary of Formats
Syntax
$VARYINGw. length-variable
Syntax Description
w
specifies the maximum width of the output field for any output line or output file
record.
Default 8 if the length of the variable is undefined. Otherwise, the default is the
length of the variable
Range 1–32767
length-variable
specifies a numeric variable that contains the length of the current value of the
character variable. SAS obtains the value of the length-variable by reading it
directly from a field that is described in an INPUT statement, reading the value of
a variable in an existing SAS data set, or calculating its value.
Details
Use $VARYINGw. when the length of a character value differs from record to record.
After writing a data value with $VARYINGw., the pointer's position is the first column
after the value.
Examples
datalines;
New York 8
Toronto 7
Buenos Aires 12
Tokyo 5
;
run;
proc print;
run;
data _null_;
set one;
put name $varying12. varlen;
run;
An existing data set variable contains the length of a variable. The data values and
the results follow the explanation of this SAS statement:
put @10 name $varying12. varlen;
NAME is a character variable of length 12 that contains values that vary from 1 to 12
characters in length. VARLEN is a numeric variable in the same data set that
contains the actual length of NAME for the current observation.
----+----1----+----2----+
Toronto 7 Toronto
Tokyo 5 Tokyo
The assignment statement determines the length of the varying-length variable. The
variable VARLEN contains this length and becomes the length-variable argument to
the $VARYING12. format.
----+----1----+----2----+
140 Chapter 2 / Dictionary of Formats
Toronto Toronto
Tokyo Tokyo
$w. Format
Writes standard character data.
Category: Character
Alignment: Left
Alias: $Fw.
Syntax
$w.
Syntax Description
w
specifies the width of the output field. You can specify a number or a column
range.
Default 1, if the length of the variable is undefined. Otherwise, the default is the
length of the variable.
Range 1–32767
Comparisons
The $w. format is not identical to the $CHARw. format. The $w. format trims trailing
blanks. The $CHARw. format does not trim trailing blanks.
The $w. format and the $CHARw. format do not trim leading blanks. To trim leading
blanks, use the LEFT function to left-align character data, or use list output with the
colon (:) format modifier and the format of your choice.
BESTw. Format 141
Example
data one;
input name $char5.;
datalines;
Cary
Tokyo
;
run;
data two;
set one;
put @name $5.;
put name $ 10-15;
run;
----+----1----+----2
#Cary Cary
Tokyo Tokyo
BESTw. Format
SAS chooses the best notation.
Categories: CAS
Numeric
Alignment: Right
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
BESTw.
Syntax Description
w
specifies the width of the output field.
Default 12
142 Chapter 2 / Dictionary of Formats
Range 1–32
Tip If you print numbers between 0 and .01 exclusively, use a field width of
at least 7 to avoid excessive rounding. If you print numbers between 0
and –.01 exclusively, use a field width of at least 8.
Details
When a format is not specified for writing a numeric value, SAS uses the BESTw.
format as the default format. The BESTw. format attempts to write numbers that
balance the conflicting requirements of readability, precision, and brevity. Here are
several rules:
n Values are written with the maximum readable precision, as determined by the
width. The maximum precision for floating-point numbers might be limited to 14
or 15 digits, as determined by the width.
n Integers are written without decimals.
n Numbers with decimals are written with as many digits to the left and right of the
decimal point as needed or as allowed by the width.
n Extreme values and values with leading or trailing 0s might be written in scientific
notation to fit into the specified width, to increase the precision, or to simplify the
magnitude of the number. Extremely small values might be written as 0 if the
width is too small for scientific notation.
n Trailing 0s are not written.
Comparisons
n The BESTw. format writes as many significant digits as possible in the output
field, but if the numbers vary in magnitude, the decimal points do not line up.
Integers are printed without a decimal.
n The Dw.p format writes numbers with the desired precision and more alignment
than the BESTw. format.
n The BESTDw.p format is a combination of the BESTw. format and the Dw.p
format in that it formats all numeric data, and it does a better job of aligning
decimals than the BESTw. format.
n The w.d format aligns decimal points, if possible, but does not necessarily show
the same precision for all numbers.
BESTDw.p Format 143
Example
data one;
x=1257000;
put x best6.;
put x best3.;
run;
The following statements produce these results:
----+----1
x=1257000;
put x best6.; 1.26E6
x=1257000;
put x best3.; 1E6
See Also
Formats:
n “BESTDw.p Format” on page 143
BESTDw.p Format
Prints numeric values, lining up decimal places for values of similar magnitude, and prints integers without
decimals.
Categories: CAS
Numeric
Alignment: Right
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
BESTDw.p
144 Chapter 2 / Dictionary of Formats
Syntax Description
w
specifies the width of the output field.
Default 12
Range 1–32
p
specifies the precision. This argument is optional.
Default 3
Range 0 to w–1
Details
The BESTDw.p format writes numbers so that the decimal point aligns in groups of
values with similar magnitude. Integers are printed without a decimal point. Larger
values of p print the data values with more precision and potentially more shifts in
the decimal point alignment. Smaller values of p print the data values with less
precision and a greater chance of decimal point alignment.
The format chooses the number of decimal places to print for ranges of values, even
when the underlying values can be represented with fewer decimal places.
Comparisons
n The BESTw. format writes as many significant digits as possible in the output
field, but if the numbers vary in magnitude, the decimal points do not line up.
Integers are printed without a decimal.
n The Dw.p format writes numbers with the desired precision and more alignment
than the BESTw. format.
n The BESTDw.p format is a combination of the BESTw. format and the Dw.p
format in that it formats all numeric data, and it does a better job of aligning
decimals than the BESTw. format.
n The w.d format aligns decimal points, if possible, but it does not necessarily
show the same precision for all numbers.
Example
data one;
input x;
BINARYw. Format 145
datalines;
12345
123.45
1.2345
.12345
;
run;
data _null_;
set one;
put x bestd9.;
run;
Variable Result
----+----1----+
12345 12345
123.45 123.4500
1.2345 1.2345
.12345 0.12345
See Also
Formats:
n “BESTw. Format” on page 141
n “Dw.p Format” on page 166
BINARYw. Format
Converts numeric values to binary representation.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
BINARYw.
146 Chapter 2 / Dictionary of Formats
Syntax Description
w
specifies the width of the output field.
Default 8
Range 1–64
Comparisons
BINARYw. converts numeric values to binary representation. The $BINARYw.
format converts character values to binary representation.
Example
data one;
input x;
datalines;
123.45
123
-123
;
run;
data two;
set one;
put x binary8.;
run;
Value of x Result
----+----1
123.45 01111011
123 01111011
-123 10000101
B8601DAw. Format
Writes date values by using the ISO 8601 basic notation yyyymmdd.
Categories: Date
B8601DAw. Format 147
ISO 8601
Alignment: Left
Restrictions: This format is not supported in a DATA step that runs in CAS.
UTC time zone offset values are not supported.
Supports: ISO 8601 Element 5.2.1.1, complete representation
Syntax
B8601DAw.
Syntax Description
w
specifies the width of the output field.
Default 10
Range 8–10
Details
The B8601DA format writes the date value by using the ISO 8601 basic date
notation yyyymmdd:
yyyy
is a four-digit year.
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 0 and 31.
Example
data one;
x='15may2018'd;
put x b8601da.;
run;
Value of x Result
21319 20180515
148 Chapter 2 / Dictionary of Formats
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
B8601DNw. Format
Writes dates from datetime values by using the ISO 8601 basic notation yyyymmdd.
Categories: Date
Date and Time
ISO 8601
Alignment: Left
Restrictions: This format is not supported in a DATA step that runs in CAS.
UTC time zone offset values are not supported.
Supports: ISO 8601 Element 5.2.1.1, complete representation
Syntax
B8601DNw.
Syntax Description
w
specifies the width of the output field.
Default 10
Range 8–10
Details
The B8601DN format writes the date from a datetime value by using the ISO 8601
basic date notation yyyymmdd:
yyyy
is a four-digit year.
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
B8601DTw.d Format 149
Example
data one;
x='15may2018:14:52:22'dt;
put x b8601dn.;
run;
Value of x Result
21319 20180515
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
B8601DTw.d Format
Writes datetime values by using the ISO 8601 basic notation yyyymmddThhmmss<ffffff>.
Categories: Date and Time
ISO 8601
Alignment: Left
Restrictions: This format is not supported in a DATA step that runs in CAS.
UTC time zone offset values are not supported.
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Supports: ISO 8601 Element 5.4.1, complete representation
Syntax
B8601DTw.d
Syntax Description
w
specifies the width of the output field.
Default 19
Range 15–26
150 Chapter 2 / Dictionary of Formats
d
specifies the number of digits to the right of the seconds value that represents a
fraction of a second. This argument is optional.
Default 0
Range 0–6
Details
The B8601DT format writes the datetime value by using the ISO 8601 basic
datetime notation yyyymmddThhmmss<ffffff>:
yyyy
is a four-digit year.
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
ffffff
are optional fractional seconds, with a precision of up to six digits, where each
digit is between 0 and 9.
Example
data one;
x='15may2018:14:52:22'dt;
put x b8601dt.;
run;
Value of x Result
---- +----1
1842015142 20180515T145222
B8601DXw. Format 151
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
B8601DXw. Format
Adjusts a Coordinated Universal Time (UTC) datetime value to the user’s local date and time. Then, writes
the local date and time by using the ISO 8601 datetime and time zone basic notation yyyymmddThhmmss
+hhmm.
Categories: Date and Time
ISO 8601
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Supports: ISO 8601 Element 5.4.1, complete representation
Syntax
B8601DXw.
Syntax Description
w
specifies the width of the output field.
Default 26
Range 20–35
Details
UTC values specify a date and a time that are based on the zero meridian in
Greenwich, England. Using this format, SAS converts a datetime value to the UTC
value and determines the user local date and time by using the value of the
TIMEZONE= system option. If the TIMEZONE= option is not set, then the user local
date and time are based on the local date and time. The B8601DX format writes
SAS datetime values by using the following ISO 8601 basic datetime notation:
n yyyymmddThhmmss+hhmm
yyyy
is a four-digit year.
mm
is a two-digit month (zero padded) between 01 and 12.
152 Chapter 2 / Dictionary of Formats
dd
is a two-digit day of the month (zero padded) between 01 and 31.
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
+|–hhmm
is an hour and minute signed offset from zero meridian time. The offset must be
+|–hhmm (that is, + or – and four characters).
Use + for time zones east of the zero meridian, and use – for time zones west of
the zero meridian. For example, +0200 indicates a two-hour time difference to
the east of the zero meridian, and –0600 indicates a six-hour time difference to
the west of the zero meridian.
Restriction: The shorter form +|–hh is not supported.
Example
The first example uses the local time to determine the time and the time zone offset.
The second example changes the time zone to America/Adak, which is Hawaii-
Aleutian Time.
Statement Result
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
B8601DZw. Format 153
B8601DZw. Format
Writes datetime values for the zero meridian Coordinated Universal Time (UTC) time by using the ISO
8601 datetime and time zone basic notation yyyymmddThhmmss+0000.
Categories: Date and Time
ISO 8601
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Supports: ISO 8601 Element 5.4.1, complete representation
Syntax
B8601DZw.
Syntax Description
w
specifies the width of the output field.
Default 26
Range 20–35
Details
UTC values specify a time and a time zone based on the zero meridian in
Greenwich, England. The B8601DZ format writes SAS datetime values for the zero
meridian date and time by using one of these ISO 8601 basic datetime notations:
n yyyymmddThhmmss+0000
Note: Use this form when w is large enough to support this time zone notation.
n yyyymmddThhmmssZ
Note: Use this form when w is not large enough to support the +0000 time zone
notation.
yyyy
is a four-digit year.
mm
is a two-digit month (zero padded) between 01 and 12.
154 Chapter 2 / Dictionary of Formats
dd
is a two-digit day of the month (zero padded) between 01 and 31.
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
+0000
indicates the UTC time for the zero meridian (Greenwich, England).
An ISO 8601 time or datetime value that specifies a time zone offset is adjusted
by the number of hours and minutes that is specified in the offset. Then, the time
zone offset is processed as the time or datetime for the zero meridian
(Greenwich, England). The B8601DZ format always writes the datetime value by
using the zero meridian offset value of +0000. To write a datetime that uses a
time zone offset other than +0000, see “B8601LZw. Format” on page 156.
Restriction: The shorter form +00 is not supported.
Z
indicates that the time is for the zero meridian (Greenwich, England) or +0000
UTC time. Z is used when the width of the format does not support the +0000
notation.
Example
data _null_;
offset_added=input('20180601T123456+0500',b8601dz.);
nooffset=input('20180601T123456Z',b8601dz.);
put offset_added b8601dz.;
put nooffset b8601dz.;
run;
20180601T073456+0000
20180601T123456+0000
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
B8601LXw. Format
Writes datetime values as local time by appending a time zone offset difference between the local time and
UTC, using the ISO 8601 basic notation yyyymmddThhmmss+|–hhmm.
Categories: Date and Time
B8601LXw. Format 155
ISO 8601
Alignment: Right
Restriction: This format is not supported in a DATA step that runs in CAS.
Supports: ISO 8601 Elements 5.3.3 and 5.3.4.2
Syntax
B8601LXw
Syntax Description
w
specifies the width of the output field.
Default 26
Range 20–35
Details
The B8601LX format writes datetime values without making any adjustments, and
appends the UTC time zone offset for the local SAS session by using the ISO 8601
basic datetime notation:
n yyyymmddThhmmss+|–hhmm
yyyy
is a four-digit year.
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
+|–hhmm
is an hour and minute signed offset from zero meridian time. The offset must be
+|–hhmm (that is, + or – and four characters).
Use + for time zones east of the zero meridian, and use – for time zones west of
the zero meridian. For example, +0200 indicates a two-hour time difference to
the east of the zero meridian, and –0600 indicates a six-hour time difference to
the west of the zero meridian.
156 Chapter 2 / Dictionary of Formats
Example
This PUT statement writes the time for the Eastern Standard time zone:
blx='01Feb2013T12:34:56'dt;
put blx b8601lx.;
1675341296 20130201T123456-0500
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
B8601LZw. Format
Writes time values as local time by appending a time zone offset difference between the local time and
UTC, using the ISO 8601 basic time notation hhmmss+|–hhmm.
Categories: Date and Time
ISO 8601
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Supports: ISO 8601 Elements 5.3.3 and 5.3.4.2
Syntax
B8601LZw.
Syntax Description
w
specifies the width of the output field.
Default 14
Range 9–20
B8601LZw. Format 157
Details
The B8601LZ format writes time values without making any adjustments, and
appends the UTC time zone offset for the local SAS session by using the ISO 8601
basic notation hhmmss+|–hhmm:
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
+|–hhmm
is an hour and minute signed offset from zero meridian time. Note that the offset
must be +|–hhmm (that is, + or – and four characters).
Use + for time zones east of the zero meridian, and use – for time zones west of
the zero meridian. For example, +0200 indicates a two-hour time difference to
the east of the zero meridian, and –0600 indicates a six-hour time difference to
the west of the zero meridian.
Restriction: The shorter form +|–hh is not supported.
When SAS reads a UTC time by using the B8601TZ informat, and the adjusted time
is greater than 24 hours or less than 00 hours, SAS adjusts the value so that the
time is between 000000 and 235959. If the B8601LZ format attempts to format a
time outside of this time range, the time is formatted with asterisks to indicate that
the value is out of range.
Example
data one;
x='15:32't;
put x b8601lz.;
run;
This PUT statement writes the time for the Eastern Standard time zone:
Value of x Result
21319 153200-0400
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
158 Chapter 2 / Dictionary of Formats
B8601TMw.d Format
Writes time values by using the ISO 8601 basic notation hhmmss<ffff>.
Categories: Time
ISO 8601
Alignment: Left
Restrictions: This format is not supported in a DATA step that runs in CAS.
UTC time zone offset values are not supported.
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Supports: ISO 8601 Element 5.3.1.1, complete representation
Syntax
B8601TMw.d
Syntax Description
w
specifies the width of the output field.
Default 8
Range 6–15
d
specifies the number of digits to the right of the seconds value that represents a
fraction of a second. This argument is optional.
Default 0
Range 0–6
Details
The B8601TM format writes SAS time values by using the ISO 8601 basic time
notation hhmmss<ffffff>:
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
B8601TXw. Format 159
ss
is a two-digit second (zero padded) between 00 and 59.
ffffff
are optional fractional seconds, with a precision of up to six digits, where each
digit is between 0 and 9.
Example
data one;
x='15:32't;
put x b8601tm.;
run;
Value of x Result
55920 153200
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
B8601TXw. Format
Adjusts a Coordinated Universal Time (UTC) value to the user’s local time. Then, writes the local time by
using the ISO 8601 basic time notation hhmmss+|-hhmm.
Categories: Time
ISO 8601
Alignment: Right
Restriction: This format is not supported in a DATA step that runs in CAS.
Supports: ISO 8601 Elements 5.3.3 and 5.3.4
Syntax
B8601TXw.
Syntax Description
w
specifies the width of the output field.
160 Chapter 2 / Dictionary of Formats
Default 14
Range 9–20
Details
UTC values specify a time based on the zero meridian in Greenwich, England.
Using this format, SAS converts a time value to the UTC value and determines the
user local time by using the TIMEZONE= system option. If the TIMEZONE= option
is not set, then the user local time is based on the local time. The B8601TX format
writes SAS datetime values by using the following ISO 8601 basic time notation:
n hhmmss+|–hhmm
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
+|–hhmm
is an hour and minute signed offset from zero meridian time. The offset must be
+|–hhmm (that is, + or – and four characters).
Use + for time zones east of the zero meridian, and use – for time zones west of
the zero meridian. For example, +0200 indicates a two-hour time difference to
the east of the zero meridian, and –0600 indicates a six-hour time difference to
the west of the zero meridian.
Restriction: The shorter form +|–hh is not supported.
When SAS reads a UTC time by using the B8601TZ informat, and the adjusted time
is greater than 24 hours or less than 00 hours, SAS adjusts the value so that the
time is between 000000 and 240000. If the B8601TX format attempts to format a
time outside of this time range, the time is formatted with asterisks to indicate that
the value is out of range.
Example
The first example uses the local time to determine the time and the time zone offset.
The second example changes the time zone to America/Adak, which is Hawaii-
Aleutian Time.
Statement Result
Statement Result
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
B8601TZw. Format
Adjusts time values to the Coordinated Universal Time (UTC) and writes the time values by using the ISO
8601 basic time notation hhmmss+|–hhmm.
Categories: Time
ISO 8601
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Supports: ISO 8601 Elements 5.3.3 and 5.3.4
Syntax
B8601TZw.
Syntax Description
w
specifies the width of the output field.
Default 14
Range 9–20
Details
UTC time values specify a time and a time zone based on the zero meridian in
Greenwich, England. The B8601TZ format adjusts the time value to be the time at
162 Chapter 2 / Dictionary of Formats
the zero meridian and writes the time value in one of these ISO 8601 basic time
notations:
n hhmmss+|–hhmm
Note: Use this form when w is large enough to support this time notation.
n hhmmssZ
Note: Use this form when w is not large enough to support the +|–hhmm time
zone notation.
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
+|–hh:mm
is an hour and minute signed offset from zero meridian time. Note that the offset
must be +|–hhmm (that is, + or – and four characters).
Use + for time zones east of the zero meridian, and use – for time zones west of
the zero meridian. For example, +0200 indicates a two-hour time difference to
the east of the zero meridian, and –0600 indicates a six-hour time difference to
the west of the zero meridian.
Restriction: The shorter form +|–hh is not supported.
Z
indicates that the time is for zero meridian (Greenwich, England) or +0000 UTC
time.
When SAS reads a UTC time by using the B8601TZ informat, and the adjusted time
is greater than 24 hours or less than 00 hours, SAS adjusts the value so that the
time is between 000000 and 240000. If the B8601TZ format attempts to format a
time outside of this time range, the time is formatted with asterisks to indicate that
the value is out of range.
Comparisons
For time values between 000000 and 240000, the B8601TZ format adjusts the time
value to be the time at the zero meridian and writes the time value in the
international standard extended time notation. The B8601LZ format makes no
adjustment to the time and writes time values in the international standard extended
time notation, using a UTC time zone offset for the local SAS session.
Example
data one;
COMMAw.d Format 163
x='15:32't;
put x b8601tz.;
run;
55920 153200+0000
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
COMMAw.d Format
Writes numeric values with a comma that separates every three digits and a period that separates the
decimal fraction.
Categories: CAS
Numeric
Alignment: Right
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
COMMAw.d
Syntax Description
w
specifies the width of the output field.
Default 6
Range 1–32
Tip Make w wide enough to write the numeric values, the commas, and the
optional decimal point.
d
specifies the number of digits to the right of the decimal point in the numeric
value. This argument is optional.
164 Chapter 2 / Dictionary of Formats
Range 0–31
Details
The COMMAw.d format writes numeric values with a comma that separates every
three digits and a period that separates the decimal fraction.
Comparisons
n The COMMAw.d format is similar to the COMMAXw.d format, but the
COMMAXw.d format reverses the roles of the decimal point and the comma.
This convention is common in European countries.
n The COMMAw.d format is similar to the DOLLARw.d format, except that the
COMMAw.d format does not print a leading dollar sign.
Example
data one;
input x;
datalines;
23451.23
123451.234
;
run;
data two;
set one;
put x comma10.2;
run;
Value of x Result
----+----1----+----2
23451.23 23,451.23
123451.234 123,451.23
COMMAXw.d Format 165
See Also
Formats:
n “COMMAXw.d Format” on page 165
n “DOLLARw.d Format” on page 180
COMMAXw.d Format
Writes numeric values with a period that separates every three digits and a comma that separates the
decimal fraction.
Categories: CAS
Numeric
Alignment: Right
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
COMMAXw.d
Syntax Description
w
specifies the width of the output field. This argument is optional.
Default 6
Range 1–32
Tip Make w wide enough to write the numeric values, the commas, and the
optional decimal point.
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Range 0–31
Details
The COMMAXw.d format writes numeric values with a period that separates every
three digits and with a comma that separates the decimal fraction.
Comparisons
The COMMAw.d format is similar to the COMMAXw.d format, but the COMMAXw.d
format reverses the roles of the decimal point and the comma. This convention is
common in European countries.
Example
data one;
input x;
datalines;
23451.23
123451.234
;
run;
data two;
set one;
put x commax10.2;
run;
Value of x Result
----+----1----+----2
23451.23 23.451,23
123451.234 123.451,23
Dw.p Format
Prints numeric values, possibly with a great range of values, lining up decimal places for values of similar
magnitude.
Categories: CAS
Numeric
Alignment: Right
Dw.p Format 167
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
Dw.p
Syntax Description
w
specifies the width of the output field. This argument is optional.
Default 12
Range 1–32
p
specifies the precision. This argument is optional.
Default 3
Range 0–16
If zero is the desired precision, use the w.d format in place of the
Dw.p format.
Details
The Dw.p format writes numbers so that the decimal point aligns in groups of values
with similar magnitude. Larger values of p print the data values with more precision
and potentially more shifts in the decimal point alignment. Smaller values of p print
the data values with less precision and a greater chance of decimal point alignment.
Comparisons
n The BESTw. format writes as many significant digits as possible in the output
field, but if the numbers vary in magnitude, the decimal points do not line up.
n Dw.p writes numbers with the desired precision and more alignment than the
BESTw. format.
n The BESTDw.p format is a combination of the BESTw. format and the Dw.p
format in that it formats all numeric data, and it does a better job of aligning
decimals than the BESTw. format.
168 Chapter 2 / Dictionary of Formats
n The w.d format aligns decimal points, if possible, but it does not necessarily
show the same precision for all numbers.
Example
data one;
input x;
datalines;
12345
1234.5
123.45
12.345
1.2345
.12345
;
run;
data two;
set one;
put x d10.4;
run;
Value of x Result
----+----1
12345 12345.0
1234.5 1234.5
123.45 123.45000
12.345 12.34500
1.2345 1.23450
.12345 0.12345
See Also
Formats:
n “BESTDw.p Format” on page 143
DATEw. Format 169
DATEw. Format
Writes date values in the form ddmmmyy, ddmmmyyyy, or dd-mmm-yyyy.
Categories: CAS
Date
Alignment: Right
Syntax
DATEw.
Syntax Description
w
specifies the width of the output field.
Default 7
Range 5–11
Details
The DATEw. format writes SAS date values in the form ddmmmyy, ddmmmyyyy, or
dd-mmm-yyyy.
dd
is an integer that represents the day of the month.
mmm
is the first three letters of the month name.
yy or yyyy
is a two-digit or four-digit integer that represents the year.
Example
data one;
/* create SAS date with date literal */
x='15mar2018'd;
170 Chapter 2 / Dictionary of Formats
put x date5.;
put x date6.;
put x date7.;
put x date8.;
put x date9.;
put x date11.;
run;
The example table uses the input value of 21258, which is the SAS date value that
corresponds to March 15, 2018.
----+----1----+
See Also
Functions:
n “DATE Function” in SAS Functions and CALL Routines: Reference
Formats:
n “NLDATEw. Format”
Informats:
n “DATEw. Informat” on page 615
DATEAMPMw.d Format
Writes datetime values in the form ddmmmyy:hh:mm:ss.ss with AM or PM.
Categories: CAS
Date and Time
Alignment: Right
DATEAMPMw.d Format 171
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
DATEAMPMw.d
Syntax Description
w
specifies the width of the output field.
Default 19
Range 7–40
d
specifies the number of digits to the right of the decimal point in the seconds
value. This argument is optional.
Range 0–39
Details
The DATEAMPMw.d format writes SAS datetime values in the form
ddmmmyy:hh:mm:ss.ss.
dd
is an integer that represents the day of the month.
mmm
is the first three letters of the month name.
yy
is a two-digit integer that represents the year.
hh
is an integer that represents the hour.
mm
is an integer that represents the minutes.
ss.ss
is the number of seconds to two decimal places.
172 Chapter 2 / Dictionary of Formats
Comparisons
The DATEAMPMw.d format is similar to the DATETIMEw.d format, except that
DATEAMPMw.d prints AM or PM at the end of the time.
Example
data one;
x='14mar2018:-1:34:27'dt;
put x dateampm.;
put x dateampm7.;
put x dateampm10.;
put x dateampm13.;
put x dateampm22.2;
run;
----+----1----+----2----+
See Also
Formats:
n “DATETIMEw.d Format” on page 172
DATETIMEw.d Format
Writes datetime values in the form ddmmmyy:hh:mm:ss.ss.
Categories: CAS
Date and Time
Alignment: Right
Restriction: If w–d< 17, SAS truncates the decimal values.
DATETIMEw.d Format 173
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
DATETIMEw.d
Syntax Description
w
specifies the width of the output field.
Default 16
Range 7–40
d
specifies the number of digits to the right of the decimal point in the seconds
value. This argument is optional.
Range 0–39
Details
The DATETIMEw.d format writes SAS datetime values in the form
ddmmmyy:hh:mm:ss.ss.
dd
is an integer that represents the day of the month.
mmm
is the first three letters of the month name.
yy
is a two-digit integer that represents the year.
hh
is an integer that represents the hour in 24-hour clock time.
mm
is an integer that represents the minutes.
ss.ss
is the number of seconds to two decimal places.
174 Chapter 2 / Dictionary of Formats
Example
data one;
x='15mar2018:-1:34:27'dt;
put x datetime.;
put x datetime7.;
put x datetime12.;
put x datetime18.;
put x datetime18.1;
put x datetime19.;
put x datetime20.1;
put x datetime21.2;
run;
----+----1----+----2----+
See Also
Formats:
n “DATEw. Format” on page 169
n “TIMEw.d Format” on page 463
Functions:
n “DATETIME Function” in SAS Functions and CALL Routines: Reference
Informats:
n “DATEw. Informat” on page 615
n “DATETIMEw. Informat” on page 616
DDMMYYw. Format 175
DAYw. Format
Writes date values as the day of the month.
Categories: CAS
Date
Alignment: Right
Syntax
DAYw.
Syntax Description
w
specifies the width of the output field.
Default 2
Range 2–32
Example
data one;
x='15jun2018'd;
put x day2.;
run;
----+
put x day2.; 15
DDMMYYw. Format
Writes date values in the form ddmm<yy>yy or dd/mm/<yy>yy, where a forward slash is the separator and
the year appears as either two or four digits.
176 Chapter 2 / Dictionary of Formats
Categories: CAS
Date
Alignment: Right
Syntax
DDMMYYw.
Syntax Description
w
specifies the width of the output field.
Default 8
Range 2–10
Interaction When w has a value from 2 to 5, the date appears with as much of
the day and the month as possible. When w is 7, the date appears
as a two-digit year without slashes.
Details
The DDMMYYw. format writes SAS date values in the form ddmm<yy>yy or
dd/mm/<yy>yy:
dd
is an integer that represents the day of the month.
/
is the separator.
mm
is an integer that represents the month.
<yy>yy
is a two-digit or four-digit integer that represents the year.
Example
data one;
x='15may2018'd;
put x ddmmyy5.;
put x ddmmyy6.;
put x ddmmyy7.;
put x ddmmyy8.;
put x ddmmyy10.;
run;
DDMMYYxw. Format 177
Value of x Result
----+----1
See Also
Formats:
n “DATEw. Format” on page 169
n “DDMMYYxw. Format” on page 177
n “MMDDYYw. Format” on page 235
n “YYMMDDw. Format” on page 496
Functions:
n “MDY Function” in SAS Functions and CALL Routines: Reference
Informats:
n “DATEw. Informat” on page 615
n “DDMMYYw. Informat” on page 619
n “MMDDYYw. Informat” on page 647
n “YYMMDDw. Informat” on page 718
DDMMYYxw. Format
Writes date values in the form ddmm<yy>yy or dd-mm-yy<yy>, where the x in the format name is a
character that represents the special character that separates the day, month, and year. The special
character can be a blank character, colon (:), hyphen (-),no separator, period (.), or slash (/). The year can
be either two or four digits.
Categories: CAS
Date
Alignment: Right
178 Chapter 2 / Dictionary of Formats
Syntax
DDMMYYxw.
Syntax Description
x
identifies a separator or specifies that no separator appear between the day, the
month, and the year. The following values are valid for x:
B
separates with a blank
C
separates with a colon
D
separates with a hyphen
N
indicates no separator
P
separates with a period
S
separates with a slash
w
specifies the width of the output field.
Default 8
Range 2–10
Details
The DDMMYYxw. format writes SAS date values in the form ddmm<yy>yy or
ddxmmx<yy>yy:
dd
is an integer that represents the day of the month.
x
is a specified separator.
mm
is an integer that represents the month.
<yy>yy
is a two-digit or four-digit integer that represents the year.
DDMMYYxw. Format 179
Example
data one;
x='15jun2018'd;
put x ddmmyyc5.;
put x ddmmyyd8.;
put x ddmmyyp10.;
put x ddmmyyn8.;
run;
----+----1----+
See Also
Formats:
n “DATEw. Format” on page 169
n “DDMMYYw. Format” on page 175
n “MMDDYYxw. Format” on page 237
n “YYMMDDxw. Format” on page 499
Functions:
n “DAY Function” in SAS Functions and CALL Routines: Reference
n “MDY Function” in SAS Functions and CALL Routines: Reference
n “MONTH Function” in SAS Functions and CALL Routines: Reference
n “YEAR Function” in SAS Functions and CALL Routines: Reference
Informats:
n “DDMMYYw. Informat” on page 619
180 Chapter 2 / Dictionary of Formats
DOLLARw.d Format
Writes numeric values with a leading dollar sign, a comma that separates every three digits, and a period
that separates the decimal fraction.
Categories: CAS
Numeric
Alignment: Right
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
DOLLARw.d
Syntax Description
w
specifies the width of the output field.
Default 6
Range 2–32
d
specifies the number of digits to the right of the decimal point in the numeric
value. This argument is optional.
Range 0–31
Details
The DOLLARw.d format writes numeric values with a leading dollar sign, a comma
that separates every three digits, and a period that separates the decimal fraction.
The hexadecimal representation of the code for the dollar sign character ($) is 5B on
EBCDIC systems and 24 on ASCII systems. The monetary character that these
codes represent might be different in other countries, but DOLLARw.d always
produces one of these codes. If you need another monetary character, define your
own format with the FORMAT procedure. For more information, see “FORMAT
Procedure” in Base SAS Procedures Guide.
DOLLARXw.d Format 181
Comparisons
n The DOLLARw.d format is similar to the DOLLARXw.d format, but the
DOLLARXw.d format reverses the roles of the decimal point and the comma.
This convention is common in European countries.
n The DOLLARw.d format is the same as the COMMAw.d format, except that the
COMMAw.d format does not write a leading dollar sign.
Example
data one;
netpay=1254.71;
put netpay dollar10.2;
run;
----+----1----+
1254.71 $1,254.71
See Also
Formats:
n “COMMAw.d Format” on page 163
n “DOLLARXw.d Format” on page 181
DOLLARXw.d Format
Writes numeric values with a leading dollar sign, a period that separates every three digits, and a comma
that separates the decimal fraction.
Categories: CAS
Numeric
Alignment: Right
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
182 Chapter 2 / Dictionary of Formats
Syntax
DOLLARXw.d
Syntax Description
w
specifies the width of the output field.
Default 6
Range 2–32
d
specifies the number of digits to the right of the decimal point in the numeric
value. This argument is optional.
Default 0
Range 0–31
Details
The DOLLARXw.d format writes numeric values with a leading dollar sign, with a
period that separates every three digits, and with a comma that separates the
decimal fraction.
The hexadecimal representation of the code for the dollar sign character ($) is 5B on
EBCDIC systems and 24 on ASCII systems. The monetary character that these
codes represent might be different in other countries, but DOLLARXw.d always
produces one of these codes. If you need another monetary character, define your
own format with the FORMAT procedure. For more information, see “FORMAT
Procedure” in Base SAS Procedures Guide.
Comparisons
n The DOLLARXw.d format is similar to the DOLLARw.d format, but the
DOLLARXw.d format reverses the roles of the decimal point and the comma.
This convention is common in European countries.
n The DOLLARXw.d format is the same as the COMMAXw.d format, except that
the COMMAXw.d format does not write a leading dollar sign.
Example
data one;
DOWNAMEw. Format 183
netpay=1254.71;
put netpay dollarx10.2;
run;
----+----1----+
1254.71 $1.254,71
See Also
Formats:
n “COMMAXw.d Format” on page 165
n “DOLLARw.d Format” on page 180
DOWNAMEw. Format
Writes date values as the name of the day of the week.
Categories: CAS
Date
Alignment: Right
Syntax
DOWNAMEw.
Syntax Description
w
specifies the width of the output field.
Default 9
Range 1–32
Tip If you omit w, SAS prints the entire name of the day.
184 Chapter 2 / Dictionary of Formats
Details
If necessary, SAS truncates the name of the day to fit the format width. For
example, the DOWNAME2. format prints the first two letters of the day name.
Example
data one;
mydate='28MAR2018'd;
put mydate downame.;
run;
----+----1
See Also
Formats:
n “WEEKDAYw. Format” on page 480
DTDATEw. Format
Expects a datetime value as input and writes date values in the form ddmmmyy or ddmmmyyyy.
Categories: Date and Time
Date
Alignment: Right
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
DTDATEw.
DTDATEw. Format 185
Syntax Description
w
specifies the width of the output field.
Default 7
Range 5–9
Details
The DTDATEw. format writes SAS date values in the form ddmmmyy or
ddmmmyyyy:
dd
is an integer that represents the day of the month.
mmm
is the first three letters of the month name.
yy or yyyy
is a two-digit or four-digit integer that represents the year.
Comparisons
The DTDATEw. format produces the same type of output that the DATEw. format
produces. The difference is that the DTDATEw. format requires a datetime value.
Example
data one;
mydt='28mar2018 13:45:14'dt;
put mydt dtdate.;
put mydt dtdate9.;
run;
----+----1
See Also
Formats:
n “DATEw. Format” on page 169
DTMONYYw. Format
Writes the date part of a datetime value as the month and year in the form mmmyy or mmmyyyy.
Categories: CAS
Date
Date and Time
Alignment: Right
Syntax
DTMONYYw.
Syntax Description
w
specifies the width of the output field.
Default 5
Range 5–7
Details
The DTMONYYw. format writes SAS datetime values in the form mmmyy or
mmmyyyy:
mmm
is the first three letters of the month name.
yy or yyyy
is a two-digit or four-digit integer that represents the year.
DTWKDATXw. Format 187
Comparisons
The DTMONYYw. format and the MONYYw. format are similar in that they both
write date values. The difference is that DTMONYYw. expects a datetime value as
input, and MONYYw. expects a SAS date value.
Example
data one;
mydt='28mar2018 13:45:14'dt;
put mydt dtmonyy.;
put mydt dtmonyy5.;
put mydt dtmonyy6.;
put mydt dtmonyy7.;
run;
----+----1
See Also
Formats:
n “DATETIMEw.d Format” on page 172
n “MONYYw. Format” on page 247
DTWKDATXw. Format
Writes the date part of a datetime value as the day of the week and the date in the form day-of-week, dd
month-name yy (or yyyy).
Categories: CAS
Date
Date and Time
188 Chapter 2 / Dictionary of Formats
Alignment: Right
Syntax
DTWKDATXw.
Syntax Description
w
specifies the width of the output field.
Default 29
Range 3–37
Details
The DTWKDATXw. format writes SAS date values in the form day-of-week, dd
month-name, yy or yyyy.
day-of-week
is either the first three letters of the day name or the entire day name.
dd
is an integer that represents the day of the month.
month-name
is either the first three letters of the month name or the entire month name.
yy or yyyy
is a two-digit or four-digit integer that represents the year.
Comparisons
The DTWKDATXw. format is similar to the WEEKDATXw. format in that they both
write date values. The difference is that DTWKDATXw. expects a datetime value as
input, and WEEKDATXw. expects a SAS date value.
Example
data one;
mydt='28mar2018 13:45:14'dt;
put mydt dtwkdatx.;
put mydt dtwkdatx3.;
put mydt dtwkdatx8.;
put mydt dtwkdatx25.;
DTYEARw. Format 189
run;
----+----1----+----2----+
See Also
Formats:
n “DATETIMEw.d Format” on page 172
n “WEEKDATXw. Format” on page 478
DTYEARw. Format
Writes the date part of a datetime value as the year in the form yy or yyyy.
Categories: CAS
Date
Date and Time
Alignment: Right
Syntax
DTYEARw.
Syntax Description
w
specifies the width of the output field.
Default 4
Range 2–4
190 Chapter 2 / Dictionary of Formats
Details
The DTYEARw. format is similar to the YEARw. format in that they both write date
values. The difference is that DTYEARw. expects a datetime value as input, and
YEARw. expects a SAS date value.
Example
data one;
mydt='28mar2018 13:45:14'dt;
put mydt dtyear.;
put mydt dtyear2.;
put mydt dtyear3.;
put mydt dtyear4.;
run;
----+----1
See Also
Formats:
n “DATETIMEw.d Format” on page 172
n “YEARw. Format” on page 493
DTYYQCw. Format
Writes the date part of a datetime value as the year and the quarter and separates them with a colon (:).
Categories: CAS
Date
Date and Time
Alignment: Right
DTYYQCw. Format 191
Syntax
DTYYQCw.
Syntax Description
w
specifies the width of the output field.
Default 4
Range 4–6
Details
The DTYYQCw. format writes SAS datetime values in the form yy or yyyy, followed
by a colon (:) and the numeric value for the quarter of the year.
Example
data one;
mydt='28mar2018 13:45:14'dt;
put mydt dtyyqc.;
put mydt dtyyqc4.;
put mydt dtyyqc5.;
put mydt dtyyqc6.;
run;
----+----1
See Also
Formats:
192 Chapter 2 / Dictionary of Formats
Ew. Format
Writes numeric values in scientific notation.
Categories: CAS
Numeric
Alignment: Right
Syntax
Ew.
Syntax Description
w
specifies the width of the output field. The output field can display up to 14
significant digits.
Default 12
Range 7–32
Details
When formatting values in scientific notation, the E format reserves the first column
of the result for a minus sign and formats up to 14 significant digits.
Example
data one;
input value;
datalines;
1257
-1257
;
run;
data two;
set one;
put value e10.;
run;
E8601DAw. Format 193
Value of x
Result
----+----1
1257 1.257E+03
-1257 -1.257E+03
E8601DAw. Format
Writes date values by using the ISO 8601 extended notation yyyy-mm-dd.
Categories: CAS
Date
ISO 8601
Alignment: Left
Alias: IS8601DAw.
Restriction: UTC time zone offset values are not supported.
Supports: ISO 8601 Element 5.2.1.1, complete representation
Syntax
E8601DAw.
Syntax Description
w
specifies the width of the output field.
Default 10
Details
The E8601DA format writes a date by using the ISO 8601 extended notation yyyy-
mm-dd:
yyyy
is a four-digit year.
194 Chapter 2 / Dictionary of Formats
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
Example
data one;
mydt='15sep2018'd;
put mydt e8601da.;
run;
21442 2018-09-15
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
E8601DNw. Format
Writes dates from SAS datetime values by using the ISO 8601 extended notation yyyy-mm-dd.
Categories: CAS
Date
Date and Time
ISO 8601
Alignment: Left
Alias: IS8601DN
Restriction: UTC time zone offset values are not supported.
Supports: ISO 8601 Element 5.2.1.1, complete representation
Syntax
E8601DNw.
E8601DTw.d Format 195
Syntax Description
w
specifies the width of the input field.
Default 10
Details
The E8601DN format writes the date by using the ISO 8601 extended date notation
yyyy-mm-dd:
yyyy
is a four-digit year.
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
Example
data one;
mydt='15sep2018 14:52:22'dt;
put mydt e8601dn.;
run;
1852642342 2018-09-15
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
E8601DTw.d Format
Writes datetime values by using the ISO 8601 extended notation yyyy-mm-ddThh:mm:ss.ffffff.
Categories: CAS
Date and Time
196 Chapter 2 / Dictionary of Formats
ISO 8601
Alignment: Left
Alias: IS8601DTw.d
Restriction: UTC time zone offset values are not supported.
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Supports: ISO 8601 Element 5.4.1, complete representation
Syntax
E8601DTw.d
Syntax Description
w
specifies the width of the input field.
Default 19
Range 16–26
d
specifies the number of digits to the right of the decimal point in the seconds
value. This argument is optional.
Default 0
Range 0–6
Details
The E8601DT format writes datetime values by using the ISO 8601 extended
datetime notation yyyy-mm-ddThh:mm:ss.ffffff:
yyyy
is a four-digit year.
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
E8601DXw. Format 197
ss
is a two-digit second (zero padded) between 00 and 59.
ffffff
are optional fractional seconds, with a precision of up to six digits, where each
digit is between 0 and 9.
Note: If you specify a width of 16, SAS assumes that the value for seconds is 0 and
omits them from the output.
Example
data one;
mydt='15sep2018 14:52:22'dt;
put mydt e8601dt25.3;
run;
1852642342 2018-09-15T14:52:22.000
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
E8601DXw. Format
Adjusts a Coordinated Universal Time (UTC) datetime value to the user’s local date and time. Then, writes
the local date and time by using the ISO 8601 datetime and time zone extended notation yyyy-mm-
ddThh:mm:ss+hh:mm.
Categories: Date and Time
ISO 8601
Alignment: Left
Supports: ISO 8601 Element 5.4.1, complete representation
Syntax
E8601DXw.
198 Chapter 2 / Dictionary of Formats
Syntax Description
w
specifies the width of the output field.
Default 26
Range 20–35
Details
UTC values specify a date and time that are based on the zero meridian in
Greenwich, England. Using this format, SAS converts a datetime value to the UTC
value and determines the user local date and time by using the value of the
TIMEZONE= system option. If the TIMEZONE= option is not set, the user local date
and time are based on the local date and time. The E8601DX format writes SAS
datetime values by using this ISO 8601 basic datetime notation:
n yyyy-mm-ddThh:mm:ss+hh:mm
yyyy
is a four-digit year.
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
+|–hh:mm
is an hour and minute signed offset from zero meridian time. The offset must be
+|–hh:mm (that is, + or – and four characters).
Use + for time zones east of the zero meridian, and use – for time zones west of
the zero meridian. For example, +02:00 indicates a two-hour time difference to
the east of the zero meridian, and –06:00 indicates a six-hour time difference to
the west of the zero meridian.
Restriction: The shorter form +|–hh is not supported.
Example
The first example uses the local time to determine the time. The second example
changes the time zone to America/Adak, which is Hawaii-Aleutian Time.
E8601DZw. Format 199
Statement Result
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
E8601DZw. Format
Writes datetime values for the zero meridian Coordinated Universal Time (UTC) by using the ISO 8601
datetime and time zone extended notation yyyy-mm-ddThh:mm:ss+00:00.
Categories: CAS
Date and Time
ISO 8601
Alignment: Left
Alias: IS8601DZw.
Restriction: UTC time zone offset values are not supported.
Supports: ISO 8601 Element 5.4.1, complete representation
Syntax
E8601DZw.
Syntax Description
w
specifies the width of the output field.
Default 26
Range 20–35
200 Chapter 2 / Dictionary of Formats
Details
UTC values specify a time and a time zone based on the zero meridian in
Greenwich, England. The E8601DZ format writes SAS datetime values by using one
of these ISO 8601 extended datetime notations:
n yyyy-mm-ddThh:mm:ss+00:00
Note: Use this form when w is large enough to support this time zone notation.
n yyyy-mm-ddThh:mm:ssZ
Note: Use this form when w is not large enough to support the +00:00 time zone
notation.
yyyy
is a four-digit year.
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
hh
is a two-digit hour (zero padded) between 00 and 24.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
+00:00
indicates that the time is for zero meridian (Greenwich, England) time.
An ISO 8601 time or datetime value that specifies a time zone offset is adjusted
by the number of hours and minutes that is specified in the offset and processed
as the time or datetime for the zero meridian (Greenwich, England). The
E8601DZ format always writes the datetime value by using the zero meridian
offset value of +00:00. To write a datetime that uses the UTC offset other than
+00:00, see “E8601LZw. Format” on page 202.
Restriction: The shorter form +00 is not supported.
Z
indicates that the time is for zero meridian (Greenwich, England) or +00:00 UTC.
Z is used when the width of the format does not support the +00:00 notation.
Example
data one;
mydt='15sep2018 14:52:22'dt;
put mydt e8601dz.;
run;
E8601LXw. Format 201
1852642342 2018-09-15T14:52:22+00:00
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
E8601LXw. Format
Writes datetime values as local time by appending a time zone offset difference between the local time and
UTC, using the ISO 8601 extended notation yyyy-mm-ddThh:mm:ss+|–hh:mm.
Categories: Date and Time
ISO 8601
Alignment: Right
Supports: ISO 8601 Elements 5.3.3 and 5.3.4.2
Syntax
E8601LXw
Syntax Description
w
specifies the width of the output field.
Default 26
Range 20–35
Details
The E8601LX format writes datetime values without making any adjustments, and
appends the UTC time zone offset for the local SAS session by using this ISO 8601
basic datetime notation:
n yyyy-mm-ddThh:mm:ss+hh:mm
yyyy
is a four-digit year.
202 Chapter 2 / Dictionary of Formats
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
+|–hh:mm
is an hour and minute signed offset from zero meridian time. The offset must be
+|–hh:mm (that is, + or – and four characters).
Use + for time zones east of the zero meridian, and use – for time zones west of
the zero meridian. For example, +02:00 indicates a two-hour time difference to
the east of the zero meridian, and –06:00 indicates a six-hour time difference to
the west of the zero meridian.
Restriction: The shorter form +|–hh is not supported.
Example
This example writes the time for the Eastern time zone:
data one;
mydt='15sep2018 T12:34:56'dt;
put mydt e8601lx.
run;
1852634096 2018-09-15T12:34:56-05:00
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
E8601LZw. Format
Writes time values as local time, appending the Coordinated Universal Time (UTC) offset for the local SAS
session, using the ISO 8601 extended time notation hh:mm:ss+|–hh:mm.
Categories: CAS
E8601LZw. Format 203
Time
ISO 8601
Alignment: Left
Alias: IS8601LZw.
Supports: ISO 8601 Element 5.3.1.1, complete representation
Syntax
E8601LZw.
Syntax Description
w
specifies the width of the output field.
Default 14
Range 9–20
Details
The E8601LZ format writes time values without making any adjustments, and
appends the UTC time zone offset for the local SAS session by using one of these
ISO 8601 extended time notations:
n hh:mm:ss+|–hh:mm
Note: Use this form when w is large enough to support this time notation.
n hh:mm:ssZ
Note: Use this form when w is not large enough to support the +|– hh:mm time
zone notation.
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
+|–hh:mm
is an hour and minute signed offset from zero meridian time. The offset must be
+|–hh:mm (that is, + or – and five characters).
Use + for time zones east of the zero meridian, and use – for time zones west of
the zero meridian. For example, +02:00 indicates a two-hour time difference to
204 Chapter 2 / Dictionary of Formats
the east of the zero meridian, and –06:00 indicates a six-hour time difference to
the west of the zero meridian.
Restriction: The shorter form +|–hh is not supported.
Z
indicates zero meridian (Greenwich, England) or +00:00 UTC.
SAS writes the time value by using the form hh:mm.ffffff, and appends the time zone
indicator +|–hh:mm based on the time zone offset from the zero meridian for the
local SAS session, or Z. The Z time zone indicator is used for format lengths that
are less than 14.
If the same time is written using both zone indicators, they indicate two different
times based on the UTC. For example, if the local SAS session uses Eastern Time
in the U.S., and the time value is 45824, SAS would write 12:43:44–04:00 or
16:43:44Z. The time 12:43:44–04:00 is the time 16:43:44+00:00 at the zero
meridian. The Z indicates that the time is the time at the zero meridian, or
12:43:44+00:00.
When SAS reads a UTC time by using the E8601TZ informat, and the adjusted time
is greater than 24 hours or less than 00 hours, SAS adjusts the value so that the
time is between 00:00:00 and 24:00:00. If the E8601LZ format attempts to format a
time outside of this time range, the time is formatted with asterisks to indicate that
the value is out of range.
Example
This example writes the time for the Eastern Time zone:
data one;
mytime='14:52:26't;
put mytime e8601lz.;
run;
53546 14:52:26-05:00
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
E8601TMw.d Format
Writes time values by using the ISO 8601 extended notation hh:mm:ss.ffffff.
Categories: CAS
E8601TMw.d Format 205
Time
ISO 8601
Alignment: Left
Alias: IS8601TMw.d
Restriction: UTC time zone offset values are not supported.
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Supports: ISO 8601 Element 5.3.1.1, complete representation, and 5.3.1.3, representation of
decimal fractions
Syntax
E8601TMw.d
Syntax Description
w
specifies the width of the output field.
Default 8
Range 8–15
d
specifies the number of digits to the right of the decimal point in the seconds
value. This argument is optional.
Default 0
Range 0–6
Details
The E8601TM format writes SAS time values by using the ISO 8601 extended time
notation hh:mm:ss.ffffff:
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
.ffffff
are optional fractional seconds, with a precision of up to six digits, where each
digit is between 0 and 9.
206 Chapter 2 / Dictionary of Formats
Example
data one;
mytime='14:52:26't;
put mytime e8601tm.;
run;
53546 14:52:26
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
E8601TXw. Format
Adjusts a Coordinated Universal Time (UTC) value to the user’s local time. Then, writes the local time by
using the ISO 8601 extended time notation hh:mm:ss+|–hh:mm.
Categories: Time
ISO 8601
Alignment: Right
Supports: ISO 8601 Elements 5.3.3 and 5.3.4
Syntax
E8601TXw.
Syntax Description
w
specifies the width of the output field.
Default 14
Range 9–20
E8601TXw. Format 207
Details
UTC values specify a time based on the zero meridian in Greenwich, England.
Using this format, SAS converts a time value to the UTC value and determines the
user local time by using the value of the TIMEZONE= system option. If the
TIMEZONE= option is not set, the user local time is based on the local time. The
E8601TX format writes SAS datetime values by using this ISO 8601 basic time
notation:
n hh:mm:ss+|–hh:mm
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
+|–hh:mm
is an hour and minute signed offset from zero meridian time. The offset must be
+|–hhmm (that is, + or – and four characters).
Use + for time zones east of the zero meridian, and use – for time zones west of
the zero meridian. For example, +0200 indicates a two-hour time difference to
the east of the zero meridian, and –0600 indicates a six-hour time difference to
the west of the zero meridian.
Restriction: The shorter form +|–hh is not supported.
When SAS reads a UTC time by using the E8601TZ informat, and the adjusted time
is greater than 24 hours or less than 00 hours, SAS adjusts the value so that the
time is between 000000 and 240000. If the E8601TX format attempts to format a
time outside of this time range, the time is formatted with asterisks to indicate that
the value is out of range.
Example
The first example uses the local time to determine the time and the time zone offset.
The second example changes the time zone to America/Adak, which is Hawaii-
Aleutian Time.
Statement Result
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
E8601TZw.d Format
Adjusts time values to the Coordinated Universal Time (UTC) and writes the time values by using the ISO
8601 extended notation hh:mm:ss.<fff>+|–hh:mm.
Categories: CAS
Time
ISO 8601
Alignment: Left
Alias: IS8601TZw.d
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Supports: ISO 8601 Element 5.3.1.1, complete representation
Syntax
E8601TZw.d
Syntax Description
w
specifies the width of the output field.
Default 14
Range 9–20
d
specifies the number of digits to the right of the decimal point in the seconds
value. This argument is optional.
Default 0
Range 0–6
E8601TZw.d Format 209
Details
UTC time values specify a time and a time zone based on the zero meridian in
Greenwich, England. The E8601TZ format writes time values in one of these ISO
8601 extended time notations:
n hh:mm:ss<.fff>+|–hh:mm
Note: Use this form when w is large enough to support this time zone notation.
n hh:mm:ssZ
Note: Use this form when w is not large enough to support the +|–hh:mm time
zone notation.
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
.fff
are optional fractional seconds.
+|–hh:mm
is an hour and minute signed offset from zero meridian time. The offset must be
+|–hh:mm (that is, + or – and five characters).
Restriction: The shorter form +|–hh is not supported.
Use + for time zones east of the zero meridian, and use – for time zones west of
the zero meridian. For example, +02:00 indicates a two-hour time difference to
the east of the zero meridian, and –06:00 indicates a six-hour time difference to
the west of the zero meridian.
Z
indicates zero meridian (Greenwich, England) or +00:00 UTC time.
When SAS reads a UTC time by using the E8601TZ informat and the adjusted time
is greater than 24 hours or less than 00 hours, SAS adjusts the value so that the
time is between 00:00:00 and 24:00:00. If the E8601TZ format attempts to format a
time outside of this time range, the time is formatted with asterisks to indicate that
the value is out of range.
Comparisons
For time values between 00:00:00 and 24:00:00, the E8601TZ format adjusts the
time value to be the time at the zero meridian and writes the time value in the
international standard extended time notation. The E8601LZ format makes no
adjustment to the time and writes time values in the international standard extended
time notation, using a UTC time zone offset for the local SAS session.
210 Chapter 2 / Dictionary of Formats
Example
data _null_;
input @1 time e8601tz.;
put time=;
put time e8601tz.;
datalines;
23:43:44-05:00
23:43:44Z
run;
See Also
“Working with Dates and Times by Using the ISO 8601 Basic and Extended
Notations” on page 45
EUROw.d Format
Writes numeric values with a leading euro symbol (E), a comma that separates every three digits, and a
period that separates the decimal fraction.
Category: Numeric
Alignment: Right
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
EUROw.d
Syntax Description
w
specifies the width of the output field.
Default 6
Range 1-32
EUROw.d Format 211
Tip If you want the euro symbol to be part of the output, be sure to choose
an adequate width.
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 0
Range 0-31
Comparisons
n The EUROw.d format is similar to the EUROXw.d format, but EUROXw.d format
reverses the roles of the decimal point and the comma. This convention is
common in European countries.
n The EUROw.d format is similar to the DOLLARw.d format, except that
DOLLARw.d format writes a leading dollar sign instead of the euro symbol.
Example
These examples use 1254.71 as the value of amount.
Statements Results
----+----1----+----2----+----3
data _null_;
input x;
put x euro10.2;
put x euro5.;
put x euro9.2;
put x euro15.3;
datalines;
1254.71
;
run;
SAS Log:
212 Chapter 2 / Dictionary of Formats
E1,254.71
1,255
E1,254.71
E1,254.710
4444
55555
666666
7777777
88888888
999999999
1234561234
;run;
See Also
Format:
n “EUROXw.d Format” on page 213
Informats:
n “EUROw.d Informat” in SAS National Language Support (NLS): Reference Guide
n “EUROXw.d Informat” in SAS National Language Support (NLS): Reference
Guide
EUROXw.d Format
Writes numeric values with a leading euro symbol (E), a period that separates every three digits, and a
comma that separates the decimal fraction.
Category: Numeric
Alignment: Right
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
EUROXw.d
Syntax Description
w
specifies the width of the output field.
Default 6
Range 1-32
Tip If you want the euro symbol to be part of the output, be sure to choose
an adequate width.
214 Chapter 2 / Dictionary of Formats
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 0
Range 0-31
Comparisons
n The EUROXw.d format is similar to the EUROw.d format, but EUROw.d format
reverses the roles of the comma and the decimal point. This convention is
common in English–speaking countries.
n The EUROXw.d format is similar to the DOLLARXw.d format, except that
DOLLARXw.d format writes a leading dollar sign instead of the euro symbol.
Example
These examples use 1254.71 as the value of amount.
Statements Results
----+----1----+----2----+----3
data _null_;
input x;
put x eurox10.2;
put x eurox5.;
put x eurox9.2;
put x eurox15.3;
datalines;
1254.71
; run;
SAS Log:
E1.254,71
1.255
E1.254,71
E1.254,710
Fw.d Format 215
Note: At least one W.D format was too small for the number to be printed. The
decimal might be shifted by the "BEST" format.
See Also
Format:
n “EUROw.d Format” on page 210
Informats:
n “EUROw.d Informat” in SAS National Language Support (NLS): Reference Guide
n “EUROXw.d Informat” in SAS National Language Support (NLS): Reference
Guide
Fw.d Format
Rounds the value to the nearest number that fits in the output field.
Categories: CAS
Numeric
216 Chapter 2 / Dictionary of Formats
Alignment: Right
Syntax
Fw.<d>
Required Argument
w
specifies the width of the output field.
Range 1–32
Tip Allow enough space to write the value, the decimal point, and a minus
sign, if necessary.
Optional Argument
d
specifies the number of digits to the right of the decimal point in the numeric
value. This argument is optional. If d is 0 or you omit d, Fw.d writes the value
without a decimal point.
Range 0–31
Details
Only decimal separator and negative symbol alignment complies with Common
Locale Data Repository (CLDR).
Example
data one;
x=23451.23 ;
put x F8.1;
run;
SAS writes the following results to the log:
23451.2
FLOATw.d Format 217
FLOATw.d Format
Generates a native single-precision, floating-point value by multiplying a number by 10 raised to the dth
power.
Categories: CAS
Numeric
Alignment: Left
Syntax
FLOATw.d
Syntax Description
w
specifies the width of the output field.
d
specifies the power of 10 by which to multiply the value. This argument is
optional.
Default 0
Range 0–31
Details
This format is useful in operating environments where a float value is not the same
as a truncated double. Values that are written by FLOAT4. are typically meant to be
read by some other external program that runs in your operating environment and
that expects these single-precision values.
Comparisons
The following table compares the names of float notation in several programming
languages:
SAS FLOAT4
Fortran REAL+4
C float
Example
data one;
x=1;
y=put(x,float4.);
put y;
put y hex.;
run;
The result of the put y=; statement shows the character representation of the
underlying hexadecimal values. The result of the put y=hex.; statement shows the
hexadecimal value that the FLOAT format produced. The result is a hexadecimal
representation of a binary number that is stored in little-endian form. Big-endian
IEEE systems store the hexadecimal representation as 3F800000.
Statement Value of y
put y=; €?
FRACTw. Format
Converts numeric values to fractions.
Categories: CAS
Numeric
Alignment: Right
Syntax
FRACTw.
Syntax Description
w
specifies the width of the output field.
Default 10
Range 4–32
Details
Dividing the number 1 by 3 produces the value 0.33333333. To write this value as
1/3, use the FRACTw. format. FRACTw. writes fractions in reduced form (for
example, 1/2 instead of 50/100).
Example
data one;
input x;
datalines;
0.6666666667
0.2784
;
run;
data two;
set one;
put x fract8.;
run;
220 Chapter 2 / Dictionary of Formats
Value of x Result
----+----1
0.6666666667 2/3
0.2784 174/625
HEXw. Format
Converts real binary (floating-point) values to hexadecimal representation.
Categories: CAS
Numeric
Alignment: Left
See: “HEXw. Format: Windows” in SAS Companion for Windows
“HEX Format: UNIX” in SAS Companion for UNIX Environments
Syntax
HEXw.
Syntax Description
w
specifies the width of the output field.
Default 8
Range 1–16
Tip If w<16, the HEXw. format converts real binary numbers to fixed-point
integers before writing them as hexadecimal characters. It also writes
negative numbers in two's-complement notation, and right-aligns digits.
If w is 16, HEXw. displays floating-point values in their hexadecimal
form.
Details
In any operating environment, the least significant byte written by HEXw. is the
rightmost byte. Some operating environments store integers with the least
significant digit as the first byte. The HEXw. format produces consistent results in
any operating environment regardless of the order of significance by byte.
HHMMw.d Format 221
Comparisons
The HEXw. numeric format and the $HEXw. character format both generate the
hexadecimal equivalent of values.
Example
data one;
input x;
datalines;
35.4
88
2.33
-150
;
run;
data two;
set one;
put x hex8.;
run;
Value of x Result
----+----1----+----2
35.4 00000023
88 00000058
2.33 00000002
-150 FFFFFF6A
HHMMw.d Format
Writes time values as hours and minutes in the form hh:mm.
222 Chapter 2 / Dictionary of Formats
Categories: CAS
Time
Alignment: Right
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
HHMMw.d
Syntax Description
w
specifies the width of the output field.
Default 5
Range 2–20
d
specifies the number of digits to the right of the decimal point in the minutes
value. The digits to the right of the decimal point specify a fraction of a minute.
This argument is optional.
Default 0
Range 0–19
Details
The HHMMw.d format writes SAS time values in the form hh:mm:
hh
is an integer.
Note: If hh is a single digit, HHMMw.d places a leading blank before the digit.
For example, the HHMMw.d. format writes 9:00 instead of 09:00.
mm
is an integer between 00 and 59 that represents minutes.
SAS rounds hours and minutes that are based on the value of seconds in a SAS
time value.
The HHMM format uses asterisks to format values that are outside the time range
0–24 hours, such as datetime values.
HHMMw.d Format 223
Comparisons
The HHMMw.d format is similar to the TIMEw.d format, except that the HHMMw.d
format does not print seconds.
The HHMMw.d format writes a leading blank for a single-hour digit. The TODw.d
format writes a leading 0 for a single-hour digit.
Example
data a;
mytime='12:59:56't;
put mytime hhmm.;
put mytime hhmm8.2;
run;
In the first example, SAS rounds up the time value 4 seconds based on the value of
seconds in the SAS time value. In the second example, adding a decimal
specification of 2 to the format shows that 56 seconds is 93% of a minute.
See Also
Formats:
n “HOURw.d Format” on page 224
n “MMSSw.d Format” on page 240
n “TIMEw.d Format” on page 463
n “TODw.d Format” on page 468
Functions:
n “HMS Function” in SAS Functions and CALL Routines: Reference
n “HOUR Function” in SAS Functions and CALL Routines: Reference
n “MINUTE Function” in SAS Functions and CALL Routines: Reference
n “SECOND Function” in SAS Functions and CALL Routines: Reference
n “TIME Function” in SAS Functions and CALL Routines: Reference
Informats:
n “TIMEw. Informat” on page 700
224 Chapter 2 / Dictionary of Formats
HOURw.d Format
Writes time values as hours and decimal fractions of hours.
Categories: CAS
Time
Alignment: Right
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
HOURw.d
Syntax Description
w
specifies the width of the output field.
Default 2
Range 2–20
d
specifies the number of digits to the right of the decimal point in the hour value.
Therefore, SAS prints decimal fractions of the hour. This argument is optional.
Range 0–19
Details
SAS rounds hours based on the value of minutes in the SAS time value.
The HOUR format uses asterisks to format values that are outside the time range 0–
24 hours, such as datetime values.
Example
data a;
mytime='12:59:56't;
IBw.d Format 225
See Also
Formats:
n “HHMMw.d Format” on page 221
n “MMSSw.d Format” on page 240
n “TIMEw.d Format” on page 463
n “TODw.d Format” on page 468
Functions:
n “HMS Function” in SAS Functions and CALL Routines: Reference
n “HOUR Function” in SAS Functions and CALL Routines: Reference
n “MINUTE Function” in SAS Functions and CALL Routines: Reference
n “SECOND Function” in SAS Functions and CALL Routines: Reference
n “TIME Function” in SAS Functions and CALL Routines: Reference
Informats:
n “TIMEw. Informat” on page 700
IBw.d Format
Writes native integer binary (fixed-point) values, including negative values.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
See: “IB Format: UNIX” in SAS Companion for UNIX Environments
“IBw.d Format: Windows” in SAS Companion for Windows
“IBw.d Format: z/OS” in SAS Companion for z/OS
226 Chapter 2 / Dictionary of Formats
Syntax
IBw.d
Syntax Description
w
specifies the width of the output field.
Default 4
Range 1–8
d
specifies to multiply the number by 10d. This argument is optional.
Default 0
Range 0–10
Details
The IBw.d format writes integer binary (fixed-point) values, including negative values
that are represented in two's-complement notation. IBw.d writes integer binary
values with consistent results if the values are created in the same type of operating
environment that you use to run SAS.
Comparisons
The IBw.d and PIBw.d formats are used to write native format integers. (Native
format enables you to read and write values created in the same operating
environment.) The IBRw.d and PIBRw.d formats are used to write little endian
integers in any operating environment.
To view a table that shows the type of format to use with big endian and little endian
integers, see “Writing Data Generated on Big Endian and Little Endian Platforms” on
page 37.
To view a table that compares integer binary notation in several programming
languages, see “Integer Binary Notation and Different Programming Languages” on
page 38.
IBRw.d Format 227
Example
data _null_;
x=128;
y=put(x,ib4.);
put y $hex8.;
run;
1 The result is a hexadecimal representation of a four-byte integer binary number. Each byte occupies
one column of the output field.
See Also
Formats:
n “IBRw.d Format” on page 227
IBRw.d Format
Writes integer binary (fixed-point) values in Intel and DEC formats.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
IBRw.d
Syntax Description
w
specifies the width of the output field.
Default 4
Range 1–8
d
specifies to multiply the number by 10d. This argument is optional.
228 Chapter 2 / Dictionary of Formats
Default 0
Range 0–10
Details
The IBRw.d format writes integer binary (fixed-point) values, including negative
values that are represented in two's-complement notation. IBRw.d writes integer
binary values that are generated by and for Intel and DEC operating environments.
Use IBRw.d to write integer binary data from Intel or DEC environments on other
operating environments. The IBRw.d format in SAS code allows for a portable
implementation for writing the data in any operating environment.
Comparisons
n The IBw.d and PIBw.d formats are used to write native format integers. (Native
format enables you to read and write values that are created in the same
operating environment.)
n The IBRw.d and PIBRw.d formats are used to write little endian integers,
regardless of the operating environment that you are writing on.
n In Intel and DEC operating environments, the IBw.d and IBRw.d formats are
equivalent.
To view the type of format to use with big endian and little endian integers, see
“Writing Data Generated on Big Endian and Little Endian Platforms” on page 37.
To view a table that compares integer binary notation in several programming
languages, see “Integer Binary Notation and Different Programming Languages” on
page 38.
Example
data _null_;
x=128;
y=put(x,ibr4.);
put y $hex8.;
run;
IEEEw.d Format 229
Value of x Result1
128 80000000
1 The result is a hexadecimal representation of a 4-byte integer binary number. Each byte occupies
one column of the output field.
See Also
Formats:
n “IBw.d Format” on page 225
IEEEw.d Format
Generates an IEEE floating-point value by multiplying a number by 10 raised to the dth power.
Categories: CAS
Numeric
Alignment: Left
CAUTION: Large floating-point values and floating-point values that require precision might not be
identical to the original SAS value when they are written to an IBM mainframe using the
IEEE format and read back into SAS using the IEE informat.
Syntax
IEEEw.d
Syntax Description
w
specifies the width of the output field.
Default 8
Range 1–8
d
specifies to multiply the number by 10d. This argument is optional.
230 Chapter 2 / Dictionary of Formats
Default 0
Range 0–10
Details
This format is useful in operating environments where IEEEw.d is the floating-point
representation that is used. In addition, you can use the IEEEw.d format to create
files that are used by programs in operating environments that use the IEEE
floating-point representation.
Typically, programs generate IEEE values in single-precision (4 bytes) or double-
precision (8 bytes). Programs perform truncation solely to save space on output
files. Machine instructions require that the floating-point number be one of the two
lengths. The IEEEw.d format allows other lengths, which enables you to write data
to files that contain space-saving truncated data.
Example
data _null_;
x=1;
test1=put(x,ieee4.);
put test1 $hex8.;
test2=put(x,ieee5.);
put test2 $hex10.;
run;
Value of x Result1
1 3F800000
3FF0000000
1 The result contains hexadecimal representations of binary numbers stored in IEEE form.
JULDAYw. Format
Writes date values as the Julian day of the year.
Category: Date
Alignment: Right
Restriction: This format is not supported in a DATA step that runs in CAS.
See: “Julian Date Formats and Astronomical Dates” on page 10
JULDAYw. Format 231
Syntax
JULDAYw.
Syntax Description
w
specifies the width of the output field.
Default 3
Range 3–32
Details
The JULDAYw. format writes SAS date values in the form ddd. In this syntax, the
letter d is defined as follows:
ddd
is the number of the day, 1–365 (or 1–366 for leap years).
Example
data one;
input date :mmddyy10.;
datalines;
01/12/2018
07/04/2018
;
run;
data two;
set one;
put date julday3.;
run;
The example table uses the input values of 21196, which is the SAS date value that
corresponds to January 12, 2018, and 21369, which is the SAS date value that
corresponds to July 4, 2018.
----+----1
JULIANw. Format
Writes date values as Julian dates in the form yyddd or yyyyddd.
Categories: CAS
Date
Alignment: Left
See: “Julian Date Formats and Astronomical Dates” on page 10
Syntax
JULIANw.
Syntax Description
w
specifies the width of the output field.
Default 5
Range 5–7
Tip If w is 5, the JULIANw. format writes the date with a two-digit year. If w
is 7, the JULIANw. format writes the date with a four-digit year.
Details
The JULIANw. format writes SAS date values in the form yyddd or yyyyddd:
yy or yyyy
is a two-digit or four-digit integer that represents the year.
ddd
is the number of the day, 1–365 (or 1–366 for leap years), in that year.
Example
data one;
input date :mmddyy10.;
datalines;
07/04/2018
;
run;
MDYAMPMw.d Format 233
data two;
set one;
put date julian5.;
put date julian7.;
run;
The example table uses the input value of 21369, which is the SAS date value that
corresponds to July 4, 2018 (the 185 th day of the year).
----+----1
See Also
Functions:
n “DATEJUL Function” in SAS Functions and CALL Routines: Reference
n “JULDATE Function” in SAS Functions and CALL Routines: Reference
Informats:
n “JULIANw. Informat” on page 643
MDYAMPMw.d Format
Writes datetime values in the form mm/dd/yy<yy> hh:mm AM|PM. The year can be either two or four digits.
Categories: CAS
Date and Time
Alignment: Right
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Note: The default time period is AM.
Syntax
MDYAMPMw.
234 Chapter 2 / Dictionary of Formats
Syntax Description
w
specifies the width of the output field.
Default 19
Range 8−40
d
specifies the number of digits to the right of the decimal point in the minutes
value. This argument is optional.
Default 0
Range 0–39
Details
The MDYAMPMw.d format writes SAS datetime values in the following form:
mm/dd/yy<yy> hh:mm<AM | PM>:
mm
is an integer between 1 and 12 that represents the month.
dd
is an integer between 1 and 31 that represents the day of the month.
yy or yyyy
specifies a two-digit or four-digit integer that represents the year.
hh
is an integer between 00 and 23 that represents hours.
mm
is an integer between 00 and 59 that represents minutes.
AM | PM
specifies either the time period 00:01−12:00 noon (AM) or the time period
12:01−12:00 midnight (PM). The default is AM.
date and time separator characters
is one of several special characters, such as the slash (/), colon (:), or a blank
character that SAS uses to separate date and time components.
Comparisons
The MDYAMPMw. format writes datetime values with separators in the form mm/dd/
yy<yy> hh:mm AM | PM, and requires a space between the date and the time.
The DATETIMEw.d format writes datetime values with separators in the form
ddmmmyy<yy>: hh:mm:ss.ss.
MMDDYYw. Format 235
Example
data one;
mydt='04jul2018 14:58:23'dt;
put mydt mdyampm25.;
run;
See Also
Formats:
n “DATETIMEw.d Format” on page 172
Informats:
n “MDYAMPMw.d Informat” on page 645
MMDDYYw. Format
Writes date values in the form mmdd<yy>yy or mm/dd/<yy>yy, where a forward slash is the separator and
the year appears as either two or four digits.
Categories: CAS
Date
Alignment: Right
Syntax
MMDDYYw.
Syntax Description
w
specifies the width of the output field.
Default 8
Range 2–10
236 Chapter 2 / Dictionary of Formats
Interaction When w has a value from 2 to 5, the date appears with as much of
the month and the day as possible. When w is 7, the date appears
as a two-digit year without slashes.
Details
The MMDDYYw. format writes SAS date values in one of these forms:
mmdd<yy>yy
mm/dd/<yy>yy:
In this syntax, the letters m, d, and y and the forward slash are defined as follows:
mm
is an integer that represents the month.
/
is the separator.
dd
is an integer that represents the day of the month.
<yy>yy
is a two-digit or four-digit integer that represents the year.
Example
data one;
mydt='02may2018'd;
put mydt mmddyy.;
put mydt mmddyy2.;
put mydt mmddyy3.;
put mydt mmddyy4.;
put mydt mmddyy5.;
put mydt mmddyy6.;
put mydt mmddyy7.;
put mydt mmddyy8.;
put mydt mmddyy10.;
run;
----+----1----+
See Also
Formats:
n “DATEw. Format” on page 169
n “DDMMYYw. Format” on page 175
n “MMDDYYxw. Format” on page 237
n “YYMMDDw. Format” on page 496
Functions:
n “DAY Function” in SAS Functions and CALL Routines: Reference
n “MDY Function” in SAS Functions and CALL Routines: Reference
n “MONTH Function” in SAS Functions and CALL Routines: Reference
n “YEAR Function” in SAS Functions and CALL Routines: Reference
Informats:
n “DATEw. Informat” on page 615
n “DDMMYYw. Informat” on page 619
n “YYMMDDw. Informat” on page 718
MMDDYYxw. Format
Writes date values in the form mmdd<yy>yy or mm-dd-<yy>yy, where the x in the format name is a
character that represents the special character that separates the month, day, and year. The special
character can be a hyphen (-), period (.), blank character, slash (/), colon (:), or no separator; the year can
be either two or four digits.
Categories: CAS
Date
Alignment: Right
238 Chapter 2 / Dictionary of Formats
Syntax
MMDDYYxw.
Syntax Description
x
identifies a separator or specifies that no separator appear between the month,
the day, and the year. These are valid values for x:
B
separates with a blank.
C
separates with a colon.
D
separates with a hyphen.
N
indicates no separator.
P
separates with a period.
S
separates with a slash.
w
specifies the width of the output field.
Default 7
Range 5–32
Interactions When w has a value from 2 to 5, the date appears with as much of
the month and the day as possible. When w is 7, the date appears
as a two-digit year without separators.
Details
The MMDDYYxw. format writes SAS date values in one of these forms:
mmdd<yy>yy
mmxddx<yy>yy
In this syntax, the letters m, x, d, and y are defined as follows:
mm
is an integer that represents the month.
x
is a specified separator.
MMDDYYxw. Format 239
dd
is an integer that represents the day of the month.
<yy>yy
is a two-digit or four-digit integer that represents the year.
Example
data one;
mydt='02may2018'd;
put mydt mmddyyc5.;
put mydt mmddyyd8.;
put mydt mmddyyp10.;
put mydt mmddyyn8.;
run;
----+----1----+
See Also
Formats:
n “DATEw. Format” on page 169
n “DDMMYYxw. Format” on page 177
n “MMDDYYw. Format” on page 235
n “YYMMDDxw. Format” on page 499
Functions:
n “DAY Function” in SAS Functions and CALL Routines: Reference
n “MDY Function” in SAS Functions and CALL Routines: Reference
n “MONTH Function” in SAS Functions and CALL Routines: Reference
n “YEAR Function” in SAS Functions and CALL Routines: Reference
Informats:
n “MMDDYYw. Informat” on page 647
240 Chapter 2 / Dictionary of Formats
MMSSw.d Format
Writes time values as the number of minutes and seconds since midnight.
Categories: CAS
Time
Alignment: Right
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
MMSSw.d
Syntax Description
w
specifies the width of the output field.
Default 5
Range 2–20
d
specifies the number of digits to the right of the decimal point in the seconds
value. Therefore, the SAS time value includes fractional seconds. This argument
is optional.
Range 0–19
Example
data a;
x='8:30:21't;
y='25:42:08't;
put x mmss8.;
put y mmss10.2;
run;
MMYYw. Format 241
----+----1
See Also
Formats:
n “HHMMw.d Format” on page 221
n “TIMEw.d Format” on page 463
Functions:
n “HMS Function” in SAS Functions and CALL Routines: Reference
n “MINUTE Function” in SAS Functions and CALL Routines: Reference
n “SECOND Function” in SAS Functions and CALL Routines: Reference
Informats:
n “TIMEw. Informat” on page 700
MMYYw. Format
Writes date values in the form mmM<yy>yy, where M is the separator and the year appears as either two
or four digits.
Categories: CAS
Date
Alignment: Right
Syntax
MMYYw.
Syntax Description
w
specifies the width of the output field.
242 Chapter 2 / Dictionary of Formats
Default 7
Range 5–32
Interaction When w has a value of 5 or 6, the date appears with only the last
two digits of the year. When w is 7 or more, the date appears with a
four-digit year.
Details
The MMYYw. format writes SAS date values in the form mmM<yy>yy. In this syntax,
the letters m, M, and y are defined as follows:
mm
is an integer that represents the month.
M
is the character separator.
<yy>yy
is a two-digit or four-digit integer that represents the year.
Example
data one;
dte='15may2018'd;
put dte mmyy.;
put dte mmyy5.;
put dte mmyy6.;
put dte mmyy7.;
put dte mmyy10.;
run;
----+----1----+
See Also
Formats:
n “MMYYxw. Format” on page 243
n “YYMMw. Format” on page 495
MMYYxw. Format
Writes date values in the form mm<yy>yy or mm-<yy>yy, where the x in the format name is a character
that represents the special character that separates the month and the year. The special character can be
a hyphen (-), period (.), blank character, slash (/), colon (:), or no separator. The year can be either two or
four digits.
Categories: CAS
Date
Alignment: Right
Syntax
MMYYxw.
Syntax Description
x
identifies a separator or specifies that no separator appear between the month
and the year. These are valid values for x:
C
separates with a colon.
D
separates with a hyphen.
N
indicates no separator.
P
separates with a period.
S
separates with a forward slash.
w
specifies the width of the output field.
Default 7
Range 5–32
244 Chapter 2 / Dictionary of Formats
Details
The MMYYxw. format writes SAS date values in one of these forms:
mm<yy>yy
mmx<yy>yy
In this syntax, the letters m, x, and y are defined as follows:
mm
is an integer that represents the month.
x
is a specified separator.
<yy>yy
is a two-digit or four-digit integer that represents the year.
Example
data one;
dte='15may2018'd;
put dte mmyyc5.;
put dte mmyyd.;
put dte mmyyn4.;
put dte mmyyp8.;
put dte mmyys10.;
run;
SAS Statement
Result
----+----1----+
SAS Statement
Result
See Also
Formats:
n “MMYYw. Format” on page 241
n “YYMMxw. Format” on page 501
MONNAMEw. Format
Writes date values as the name of the month.
Categories: CAS
Date
Alignment: Right
Syntax
MONNAMEw.
Syntax Description
w
specifies the width of the output field.
Default 9
Range 1–32
Tip Use MONNAME3. to print the first three letters of the month name.
Details
If necessary, SAS truncates the name of the month to fit the format width.
246 Chapter 2 / Dictionary of Formats
Example
data one;
dte='15may2018'd;
put dte monname.;
put dte monname1.;
put dte monname3.;
run;
----+----1
See Also
Formats:
n “MONTHw. Format” on page 246
MONTHw. Format
Writes date values as the month of the year.
Categories: CAS
Date
Alignment: Right
Syntax
MONTHw.
Syntax Description
w
specifies the width of the output field.
Default 2
MONYYw. Format 247
Range 1–32
Details
The MONTHw. format writes the month (1 through 12) of the year from a SAS date
value. If the month is a single digit, the MONTHw. format places a leading blank
before the digit. For example, the MONTHw. format writes 4 instead of 04.
Example
data one;
dte='15may2021'd;
put dte month.;
run;
----+----1
See Also
Formats:
n “MONNAMEw. Format” on page 245
MONYYw. Format
Writes date values as the month and the year in the form mmmyy or mmmyyyy.
Categories: CAS
Date
Alignment: Right
248 Chapter 2 / Dictionary of Formats
Syntax
MONYYw.
Syntax Description
w
specifies the width of the output field.
Default 5
Range 5–7
Details
The MONYYw. format writes SAS date values in the form mmmyy or mmmyyyy. In
this syntax, the letters m and y are defined as follows:
mmm
is the first three letters of the month name.
yy or yyyy
is a two-digit or four-digit integer that represents the year.
Comparisons
The MONYYw. format and the DTMONYYw. format are similar in that they both
write date values. The difference is that MONYYw. expects a SAS date value as
input, and DTMONYYw. expects a datetime value.
Example
data one;
dte='15may2021'd;
put dte monyy5.;
put dte monyy7.;
run;
----+----1
See Also
Formats:
n “DDMMYYw. Format” on page 175
n “DTMONYYw. Format” on page 186
n “MMDDYYw. Format” on page 235
n “NLDATEMw. Format”
n “YYMMDDw. Format” on page 496
Functions:
n “MONTH Function” in SAS Functions and CALL Routines: Reference
n “YEAR Function” in SAS Functions and CALL Routines: Reference
Informat:
n “MONYYw. Informat” on page 649
NEGPARENw.d Format
Writes negative numeric values in parentheses.
Categories: CAS
Numeric
Alignment: Right
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
NEGPARENw.d
Syntax Description
w
specifies the width of the output field.
Default 6
Range 1–32
d
specifies the number of digits to the right of the decimal point in the numeric
value. This argument is optional.
250 Chapter 2 / Dictionary of Formats
Default 0
Range 0–31
Details
The NEGPARENw.d format attempts to right-align output values. If the input value is
negative, NEGPARENw.d displays the output by enclosing the value in
parentheses, if the field that you specify is wide enough. Otherwise, it uses a minus
sign to represent the negative value. If the input value is nonnegative,
NEGPARENw.d displays the value with a leading and trailing blank to ensure proper
column alignment. It reserves the last column for a close parenthesis even when the
value is positive.
Comparisons
The NEGPARENw.d format is similar to the COMMAw.d format in that it separates
every three digits of the value with a comma.
Example
data one;
input x;
datalines;
100
1000
-200
-2000
;
run;
data two;
set one;
put x negparen8.;
run;
Value of x Result
----+----1----+
100 100
1000 1,000
-200 (200)
NENGOw. Format 251
Value of x Result
-2000 (2,000)
NENGOw. Format
Writes date values as Japanese dates in the form e.yymmdd.
Category: Date
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
NENGOw.
Syntax Description
w
specifies the width of the output field.
Default 10
Range 2–10
Details
The NENGOw. format writes SAS date values in the form e.yymmdd, where
e
is the first letter of the name of the imperial era (Meiji, Taisho, Showa, Heisei, or
Reiwa).
yy
is an integer that represents the year.
mm
is an integer that represents the month.
dd
is an integer that represents the day of the month.
If the width is too small, SAS omits the period.
252 Chapter 2 / Dictionary of Formats
Example
The example table uses the input value of 15342, which is the SAS date value that
corresponds to January 2, 2002.
data _null_;
date=15342;
put date nengo3.;
put date nengo6.;
put date nengo8.;
put date nengo9.;
put date nengo10.;
run;
H14
H14/01
H.140102
H14/01/02
H.14/01/02
See Also
Informat:
n “NENGOw. Informat” in SAS National Language Support (NLS): Reference
Guide
NLBESTw. Format
Writes the best numerical notation based on the locale.
Categories: CAS
Numeric
Alignment: Right
Syntax
NLBESTw.
Syntax Description
w
specifies the width of the output field.
Default 12
NLBESTw. Format 253
Range 1–32
Tip If you print numbers between 0 and .01 exclusively, then use a field
width of at least 7 to avoid excessive rounding. If you print numbers
between 0 and -.01 exclusively, use a field width of at least 8.
Details
The NLBEST format writes the best numerical value based on the locale's decimal
point and the sign mark's location. NLBEST is similar to the BEST format. For more
information, see the BEST format in the SAS Formats and Informats: Reference.
Example
The following code produces results based on the locale:
options locale=English_UnitedStates;
data test;
x=-1257000;
put x nlbest6.;
put x nlbest3.;
put "=====";
x=-0.1;
put x nlbest6.;
put x nlbest3.;
put "=====";
x=0.1;
put x nlbest6.;
put x nlbest3.;
put "=====";
x=1257000;
put x nlbest6.;
put x nlbest3.;
run;
-126E4
***
=====
-0.1
-.1
=====
0.1
0.1
=====
1.26E6
1E6
options locale=German_Germany;
data test;
x=-1257000;
put x nlbest6.;
put x nlbest3.;
254 Chapter 2 / Dictionary of Formats
put "=====";
x=-0.1;
put x nlbest6.;
put x nlbest3.;
put "=====";
x=0.1;
put x nlbest6.;
put x nlbest3.;
put "=====";
x=1257000;
put x nlbest6.;
put x nlbest3.;
run;
-126E4
***
=====
-0,1
-,1
=====
0,1
0,1
=====
1,26E6
1E6
options locale=ar_BH;
data test;
x=-1257000;
put x nlbest6.;
put x nlbest3.;
put "=====";
x=-0.1;
put x nlbest6.;
put x nlbest3.;
put "=====";
x=0.1;
put x nlbest6.;
put x nlbest3.;
put "=====";
x=1257000;
put x nlbest6.;
put x nlbest3.;
run;
-126E4
***
=====
-0.1
-.1
=====
0.1
0.1
=====
1.26E6
1E6
NLDATEw. Format 255
NLDATEw. Format
Writes a SAS date value as a date that is appropriate for the current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATEw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 20
Range 10–200
Comparisons
NLDATEw. is similar to DATEw. and WORDDATEw., except that NLDATEw. is
locale-specific.
Example
These examples use the input value of 15760, which is the SAS date value that
corresponds to February 24, 2003. The first example specifies the english_United
States locale. The second example specifies the german_Germany locale.
options locale=English_UnitedStates;
data test;
day=15760;
put day nldate.;
run;
options locale=German_Germany;
data test;
256 Chapter 2 / Dictionary of Formats
day=15760;
put day nldate.;
run;
See Also
Formats:
n “NLDATEMNw. Format” on page 262
n “NLDATEWw. Format” on page 265
n “NLDATEWNw. Format” on page 267
NLDATELw. Format
Writes a SAS date value as a date in the form month, date, year that is appropriate for the current SAS
locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATELw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 18
Range 2–200
Details
NLDATEL writes the date in a long-uniform pattern with the full length of the month
and week names.
NLDATEMw. Format 257
Example
This example uses the date November 19, 2012.
data _null_;
dt = dt='19Nov2012:00:00:00'dt;
dy='19Nov2012'd;
put "+--- NLDATEL min=2 default=18
max=200 ---+";
put dy nldatel.;
put dy nldatel10.;
put dy nldatel12.;
put dy nldatel18.;
put dy nldatel200.;
run;
NLDATEMw. Format
Writes a SAS date value as a date in a medium-uniform pattern that is appropriate for the current SAS
locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATEMw
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 14
Range 2–200
258 Chapter 2 / Dictionary of Formats
Details
NLDATEM writes the date in a medium-uniform pattern such as Nov 19, 2012.
Example
This example specifies the date Nov 19, 2012.
data _null_;
dt = dt='19Nov2012:00:00:00'dt;
dy='19Nov2012'd;
put '+--- NLDATEM min=2 default=14
max=200 ---+';
put dy nldatem.;
put dy nldatem8.;
put dy nldatem14.;
put dy nldatem200.;
run;
NLDATEMDw. Format
Writes the SAS date value as the name of the month and the day of the month that is appropriate for the
current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATEMDw.
Syntax Description
w
specifies the width of the output field.
Default 16
NLDATEMDLw. Format 259
Range 6-200
Example
This example specifies the english_United States locale option.
option locale=en_US;
data _null_;
dy = date();
put dy nldatemd.;
run;
April 03
See Also
Format:
n “NLDATEYMw. Format” on page 268
NLDATEMDLw. Format
Writes a SAS date value as the month and day of the month that is appropriate for the current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATEMDLw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 12
Range 5–200
260 Chapter 2 / Dictionary of Formats
Details
NLDATEMDL writes the date in a long-uniform pattern with the full length of the
month and the day such as November 19.
Example
The following example specifies the date of November 19, 2012.
data _null_;
dt = dt='19Nov2012:00:00:00'dt;
dy='19Nov2012'd;
put '+--- NLDATEMDL min=5 default=12
max=200 ---+';
put dy nldatemdl.;
put dy nldatemdl5.;
put dy nldatemdl9.;
put dy nldatemdl12.;
put dy nldatemdl200.;
run;
NLDATEMDMw. Format
Writes a SAS date value as the month and day of the month that is appropriate for the current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATEMDMw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
NLDATEMDSw. Format 261
Default 9
Range 5–200
Details
NLDATEMDM writes the date in a medium-uniform pattern with abbreviation of the
month and the day using numbers and delimiters, such as Nov 19.
Example
The following example specifies the date of November 19, 2012.
data _null_;
dt = dt='19Nov2012:00:00:00'dt;
dy='19Nov2012'd;
put '+--- NLDATEMDL min=5 default=9
max=200 ---+';
put dy nldatemdm.;
put dy nldatemdm5.;
put dy nldatemdm9.;
put dy nldatemdm200.;
run;
NLDATEMDSw. Format
Writes a SAS date value as the month and day of the month in a short-uniform pattern that is appropriate
for the current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATEMDSw.
262 Chapter 2 / Dictionary of Formats
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 5
Range 5–200
Details
NLDATEMDS writes the date in a short-uniform pattern in full length of the month
and the day using numbers and delimiters, such as MM/dd.
Example
The following example specifies the date of November 19, 2012.
data _null_;
dt = dt='19Nov2012:00:00:00'dt;
dy='19Nov2012'd;
put '+--- NLDATEMDL min=5 default=5
max=200 ---+';
put dy nldatemds.;
put dy nldatemds5.;
put dy nldatemds5.;
put dy nldatemds200.;
run;
NLDATEMNw. Format
Writes a SAS date value as the name of the month that is appropriate for the current SAS locale.
Categories: CAS
Date
Alignment: Left
NLDATEMNw. Format 263
Syntax
NLDATEMNw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the name of
the month to fit the format width.
Default 9
Range 4–200
Details
NLDATEMN writes values in a uniform pattern which ensures that the output has the
same pattern when using the same format width but different input data.
This example demonstrates uniform pattern. This example uses a UTF-8 session
and the width value is 6 for both statements.
option locale = zh_cn;
data test;
x = '08jun91'd;
put x nldatemn6.;
= '08sep91'd;
put x nldatemn6.;
run;
6
12
Comparisons
NLDATEMNw. is similar to MONNAMEw., except that NLDATEMNw. is locale-
specific.
Example
These examples specify the input value of 15760, which is the SAS date value that
corresponds to February 24, 2003. The first example specifies the en_US locale.
The second example specifies the german_Germany locale.
option locale=en_US;
data _null_;
month=15760;
264 Chapter 2 / Dictionary of Formats
February
option locale=german_germany;
data _null_;
month=15760;
put month nldatemn.;
run;
Februar
See Also
Formats:
n “NLDATEw. Format” on page 255
n “NLDATEWw. Format” on page 265
n “NLDATEWNw. Format” on page 267
NLDATESw. Format
Writes a SAS date value as a date string that is appropriate for the current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATESw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 10
Range 2–200
NLDATEWw. Format 265
Details
NLDATES writes the date in a short-uniform pattern that contains only numbers and
delimiters, such as mm/dd/yyyy.
Example
This example specifies the date November 19, 2012. This example specifies the
en_US locale.
option locale=en_US;
data _null_;
dt = dt='19Nov2012:00:00:00'dt;
dy='19Nov2012'd;
put '+--- NLDATEMDL min=2 default=10
max=200 ---+';
put dy nldates.;
put dy nldates8.;
put dy nldates10.;
put dy nldates200.;;
run;
NLDATEWw. Format
Writes a SAS date value as the date and the day of the week that is appropriate for the current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATEWw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date
and the day of the week to fit the format width.
266 Chapter 2 / Dictionary of Formats
Default 29
Range 10–200
Details
The NLDATEW format might produce inaccurate localized output when using the
default width with some encoding and locale combinations because the date and
time names are too long. Please refer to Exceptions for Date and Time Default
Widths for information about recommended widths for locale and encoding
combinations. You might need to use the recommended width.
NLDATEW writes the date value in a uniform pattern which ensures that the output
has the same pattern when using the same format width but different input data.
Comparisons
NLDATEWw. is similar to WEEKDATEw., except that NLDATEWw. is locale specific.
Example
These examples use the input value of 15760, which is the SAS date value that
corresponds to February 24, 2003. The first example specifies the en_US locale.
The second example specifies the de_DE locale.
options locale=en_US;
data _null_;
dy=15760;
put dy nldatew.;
put dy nldatew20.;
put dy nldatew200.;
run;
options locale=de_DE;
data _null_;
dy=15760;
put dy nldatew.;
put dy nldatew20.;
put dy nldatew200.;
run;
NLDATEWNw. Format 267
See Also
Formats:
n “NLDATEw. Format” on page 255
n “NLDATEMNw. Format” on page 262
n “NLDATEWNw. Format” on page 267
NLDATEWNw. Format
Writes the SAS date value as the day of the week that is appropriate for the current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATEWNw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the day of
the week to fit the format width.
Default 9
Range 4–200
Details
NLDATEWN writes the date value in a uniform pattern which ensures that the output
has the same pattern when using the same format width but different input data.
268 Chapter 2 / Dictionary of Formats
Comparisons
NLDATEWNw. is similar to DOWNAMEw., except that NLDATEWNw. is locale-
specific.
Example
These examples use the input value of 15760, which is the SAS date value that
corresponds to February 24, 2003. The first example specifies the en_US locale.
The second example specifies the de_DE locale.
options locale=en_US;
data _null_;
dy=15760;
put dy nldatewn.;
run;
Monday
options locale=de_DE;
data _null_;
dy=15760;
put dy nldatewn10.;
run;
Montag
See Also
Formats:
n “NLDATEw. Format” on page 255
n “NLDATEMNw. Format” on page 262
n “NLDATEWw. Format” on page 265
NLDATEYMw. Format
Writes the SAS date value as the year and the name of the month that is appropriate for the current SAS
locale.
Categories: CAS
Date
Alignment: Left
NLDATEYMw. Format 269
Syntax
NLDATEYMw.
Syntax Description
w
specifies the width of the output field.
Default 16
Range 6–200
Details
If you specify a width of 6, but your data is larger than 6, your output contains
asterisks: d=******. To remove the asterisks, you can use PROC LOCALEDATA.
The following example uses PROC LOCALEDATA to write the date without the
asterisks:
PROC LOCALEDATA;
LOAD SASLOCALE;
MODIFY key=DATE_YYMM_SHORT_FORMAT value='%b %y' ;
SAVE REGISTRY / _ALL_ syntax=SAS;
data _null_;
format d nldateym6.;
d = '17OCT14'd;
put d=;
run;
d=Oct 14
Example
This example specifies the spanish_Spain locale option. This example specifies the
date of April 4, 2019.
options locale=spanish_Spain;
data _null_;
dy=today();
put dy nldateym.;
put dy nldateym12.;
put dy nldateym200.;
run;
270 Chapter 2 / Dictionary of Formats
abril de 2019
abr de 2019
abril de 2019
See Also
Format:
n “NLDATEMDw. Format” on page 258
NLDATEYMLw. Format
Writes a SAS date value as the month and year that is appropriate for the current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATEYMLw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 14
Range 5–200
Details
NLDATEYML writes the date in a long-uniform pattern with abbreviations for the
month and year, such as April 2019.
NLDATEYMMw. Format 271
Example
This example specifies the date April 4, 2019. This example specifies the en_US
locale.
options locale=en_US;
data _null_;
dt = datetime();
dy = date();
put "+--- NLDATEYML min=5 default=14 max=200 ---+";
put dy nldateyml.;
put dy nldateyml7.;
put dy nldateyml11.;
put dy nldateyml14.;
put dy nldateyml200.;
run;
NLDATEYMMw. Format
Writes a SAS date value as the month and year with abbreviations that is appropriate for the current SAS
locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATEYMMw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 11
Range 5–200
272 Chapter 2 / Dictionary of Formats
Details
NLDATEYMS writes the date in a medium-uniform pattern with abbreviations for the
month and year, such as Apr 2019.
Example
This example specifies the date April 4, 2019. This example specifies the en_US
locale.
options locale=en_US;
data _null_;
dt = datetime();
dy = date();
put "+--- NLDATEYML min=5 default=14 max=200 ---+";
put dy nldateymm.;
put dy nldateymm7.;
put dy nldateymm11.;
put dy nldateymm200.;
run;
NLDATEYMSw. Format
Writes a SAS date value as a date and year that is appropriate for the current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATEYMSw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
NLDATEYQw. Format 273
Default 7
Range 5–200
Details
NLDATEYMS writes the date in a short-uniform pattern with numbers and delimiters
such as mm/yyy.
Example
This example specifies the date April 4, 2019. This example specifies the en_US
locale.
options locale=en_US;
data _null_;
dt = datetime();
dy = date();
put "+--- NLDATEYMS min=5 default=14 max=200 ---+";
put dy nldateyms.;
put dy nldateyms5.;
put dy nldateyms7.;
put dy nldateyms200.;
run;
NLDATEYQw. Format
Writes the SAS date value as the year and the quarter that is appropriate for the current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATEYQw.
274 Chapter 2 / Dictionary of Formats
Syntax Description
w
specifies the width of the output field.
Default 16
Range 4–200
Details
The NLDATEYQ format might produce inaccurate localized output when using the
default width with some encoding and locale combinations because the date and
time names are too long. Please refer to Exceptions for Date and Time Default
Widths for information about recommended widths for locale and encoding
combinations. You might need to use the recommended width.
Example
This example specifies the date April 4, 2019. This example specifies the fr_FR
locale option.
options locale=fr_FR;
data _null_;
dy=today();
dt=datetime();
put "+--- NLDATEYQ min=4 default=16 max=200 ---+";
put ' 16' +5 dy nldateyq.;
put ' 4' +5 dy nldateyq4.;
put ' 14' +5 dy nldateyq14.;
put ' 32' +5 dy nldateyq32.;
put '200' +5 dy nldateyq200.;
run;
NLDATEYQLw. Format
Writes a SAS date value as the year and the year’s quarter value (Q1–Q4) using abbreviations that is
appropriate for the current SAS locale.
Categories: CAS
NLDATEYQLw. Format 275
Date
Alignment: Left
Syntax
NLDATEYQLw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 18
Range 4–200
Details
NLDATEYQL writes the date in a long-uniform pattern with full length for the year
and year’s quarter value, such as 2nd quarter 2019.
Example
This example specifies the date April 4, 2019. This example specifies the en_US
locale option.
options locale=en_US;
data _null_;
dt = datetime();
dy = date();
put '+--- NLDATEYQL min=4 default=18 max=200 ---+';
put dy nldateyql.;
put dy nldateyql6.;
put dy nldateyql7.;
put dy nldateyql18.;
put dy nldateyql200.;
run;
NLDATEYQMw. Format
Writes a SAS date value as the year and the year’s quarter value (Q1–Q4) using abbreviations that is
appropriate for the current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATEYQMw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 7
Range 4–200
Details
NLDATEYQM writes the date in a medium-uniform pattern with abbreviations for the
year and year’s quarter value, such as Q2 2019.
Example
The following example uses the date April 4, 2019.
data _null_;
dt = datetime();
dy = date();
put '+--- NLDATEYQM min=4 default=7 max=200 ---+';
put dy nldateyqm.;
put dy nldateyqm6.;
put dy nldateyqm7.;
put dy nldateyqm200.;
run;
NLDATEYQSw. Format 277
NLDATEYQSw. Format
Writes a SAS date value as the year and the year’s quarter value (1–4) with numbers and delimiters that is
appropriate for the current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATEYQSw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 6
Range 4–200
Details
NLDATEYQS writes the date in a short-uniform pattern with numbers and delimiters
for the year and year’s quarter value, such as 2019/2.
Example
The following example specifies the date April 4, 2019.
data _null_;
dt = datetime();
dy = date();
put '+--- NLDATEYQS min=4 default=6 max=200 ---+';
put dy nldateyqs.;
278 Chapter 2 / Dictionary of Formats
put dy nldateyqs4.;
put dy nldateyqs6.;
put dy nldateyqs200.;
run;
NLDATEYRw. Format
Writes the SAS date value as the year that is appropriate for the current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATEYRw.
Syntax Description
w
specifies the width of the output field.
Default 16
Range 2–200
Example
This example specifies the fr_FR locale option. This example specifies the date April
4, 2019.
options locale=fr_FR;
data _null_;
dt = datetime();
dy = date();
put '+--- NLDATEYR min=4 default=6 max=200 ---+';
put dy nldateyr.;
put dy nldateyr2.;
put dy nldateyr8.;
put dy nldateyr200.;
NLDATEYWw. Format 279
run;
NLDATEYWw. Format
Writes the SAS date value as the year and the week that is appropriate for the current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATEYWw.
Syntax Description
w
specifies the width of the output field.
Default 16
Range 5–200
Example
This example specifies the date April 4, 2019. This example specifies the fr_FR
locale option.
options locale=fr_FR;
data _null_;
dt = datetime();
dy = date();
put "+--- NLDATEYW min=5 default=16 max=200 ---+";
put ' 16' +5 dy nldateyw.;
put ' 5' +5 dy nldateyw5.;
put ' 8' +5 dy nldateyw8.;
put ' 32' +5 dy nldateyw32.;
put '200' +5 dy nldateyw200.;
run;
280 Chapter 2 / Dictionary of Formats
NLDATMw. Format
Writes a SAS datetime value as a datetime that is appropriate for the current SAS locale.
Categories: CAS
Date and Time
Alignment: Left
Syntax
NLDATMw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the datetime
value to fit the format width.
Default 30
Range 10–200
Comparisons
The NLDATMw. format is similar to the DATETIMEw. format, except that the
NLDATMw. format is locale-specific.
Example
These examples specify the input value of 1361709583, which is the SAS datetime
value that corresponds to 12:39:43 p.m. on February 24, 2003. The first example
specifies the en_US locale. The second example specifies the de_DE locale.
options locale=en_US;
data _null_;
dy=1361709583;
NLDATMAPw. Format 281
put dy nldatm.;
run;
24Feb2003:12:39:43
options locale=de_DE;
data _null_;
dy=1361709583;
put dy nldatm.;
run;
See Also
Formats:
n “NLDATMAPw. Format” on page 281
n “NLDATMTMw. Format” on page 293
n “NLDATMWw. Format” on page 295
NLDATMAPw. Format
Wries a SAS datetime value as a datetime with a.m. or p.m. that is appropriate for the current SAS locale.
Categories: CAS
Date and Time
Alignment: Left
Syntax
NLDATMAPw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date-
time value to fit the format width.
Default 32
Range 16–200
282 Chapter 2 / Dictionary of Formats
Comparisons
The NLDATMAPw. format is similar to DATEAMPMw., except that the
NLDATMAPw. format is locale-specific.
Example
These examples specify the input value of 1361709583, which is the SAS date-time
value that corresponds to 12:39:43 p.m. on February 24, 2003. The first example
specifies the en_US locale. The second example specifies the es_MX locale.
options locale=en_US;
data _null_;
dy=1361709583;
put dy nldatmap.;
run;
options locale=es_MX;
data _null_;
dy=1361709583;
put dy nldatmap200.;
run;
See Also
Formats:
n “NLDATMw. Format” on page 280
n “NLDATMTMw. Format” on page 293
n “NLDATMWw. Format” on page 295
NLDATMDTw. Format
Writes the SAS datetime value as the name of the month, day of the month and year that is appropriate for
the current SAS locale.
Categories: CAS
Date
Date and Time
NLDATMDTw. Format 283
Alignment: Left
Syntax
NLDATMDTw.
Syntax Description
w
specifies the width of the output field
Default 18
Range 10-200
Details
NLDATMDT writes the date value in a uniform pattern which ensures that the output
has the same pattern when using the same format width but different input data.
Example
This example specifies the value 86400, which corresponds to January 2, 1960. The
first example specifies the english_United States locale. The second example
specifies the turkish_Turkey locale.
options locale=en_US;
data _null_;
x=86400;
put x nldatmdt.;
run;
January 2, 1960
options locale=tr_TR;
data _null_;
x=86400;
put x nldatmdt200.;
run;
2 Ocak 1960
284 Chapter 2 / Dictionary of Formats
See Also
Formats:
n “NLDATMMDw. Format” on page 286
NLDATMLw. Format
Writes a SAS datetime value as a long representation of the date that is appropriate for the current SAS
locale.
Categories: CAS
Date and Time
Alignment: Left
Syntax
NLDATMLw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 30
Range 9–200
Details
NLDATML writes the date in a long-uniform pattern with the full length of the month,
date, year, and time, such as April 10, 2019 03:13:27 PM.
Example
data _null_;
dt = datetime();
dy = date();
put "+--- NLDATML min=9 default=30
max=200 ---+";
put dt nldatml.;
NLDATMMw. Format 285
put dt nldatml19.;
put dt nldatml24.;
put dt nldatml30.;
put dt nldatml200.;
run;
NLDATMMw. Format
Writes a SAS datetime value as a medium representation of the date that is appropriate for the current
SAS locale.
Categories: CAS
Date and Time
Alignment: Left
Syntax
NLDATMMw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 24
Range 9–200
Details
NLDATMM writes the date in a medium-uniform pattern with abbreviations of the
month and week names, such as Apr 10, 2019 03:23:34 PM.
286 Chapter 2 / Dictionary of Formats
Example
data _null_;
dt = datetime();
dy = date();
put '+--- NLDATMM min=9 default=30
max=200 ---+';
put dt NLDATMM.;
put dt NLDATMM19.;
put dt NLDATMM24.;
put dt NLDATMM30.;
put dt NLDATMM200.;
run;
NLDATMMDw. Format
Writes the SAS datetime value as the name of the month and the day of the month that is appropriate for
the current SAS locale.
Categories: CAS
Date
Date and Time
Alignment: Left
Syntax
NLDATMMDw.
Syntax Description
w
specifies the width of the output field.
Default 16
Range 6–200
NLDATMMDLw. Format 287
Example
This example uses the en_US locale option.
options locale=en_US;
data _null_;
x=put(86400,nldatmmd.);
put x=;
run;
x=January 02
See Also
Format:
n “NLDATMYMw. Format” on page 299
NLDATMMDLw. Format
Writes a SAS date value as the full-length of the month and day of the month that is appropriate for the
current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATMMDLw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 12
Range 5–200
288 Chapter 2 / Dictionary of Formats
Details
NLDATMMDL writes the date in a long-uniform pattern with full-length of the month
and the day, such as November 19.
Example
The following example uses the date of April 12, 2019.
data _null_;
dt = datetime();
dy = date();
put '+--- NLDATMMDL min=5 default=12
max=200 ---+';
put dt nldatmmdl.;
put dt nldatmmdl5.;
put dt nldatmmdl9.;
put dt nldatmmdl12.;
put dt nldatmmdl200.;
run;
NLDATMMDMw. Format
Writes a SAS date value as the month and day of the month using abbreviations that is appropriate for the
current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATMMDMw.
NLDATMMDSw. Format 289
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 9
Range 5–200
Details
NLDATMMDM writes the date in a medium-uniform pattern with abbreviations of the
month and the day, such as Nov 19.
Example
The following example uses the date of April 12, 2019.
data _null_;
dt = datetime();
dy = date();
put '+--- NLDATMMDM min=5 default=9
max=200 ---+';
put dt nldatmmdm.;
put dt nldatmmdm5.;
put dt nldatmmdm9.;
put dt nldatmmdm200.;
run;
NLDATMMDSw. Format
Writes a SAS date value as the month and day of the month using numbers and delimiters that is
appropriate for the current SAS locale.
Categories: CAS
Date
Alignment: Left
290 Chapter 2 / Dictionary of Formats
Syntax
NLDATMMDSw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 5
Range 5–200
Details
NLDATMMDS writes the date in a short-uniform pattern with numbers and delimiters
of the month and the day, such as 4/12.
Example
The following example uses the date of April 12, 2019.
data _null_;
dt = datetime();
dy = date();
put '+--- NLDATMMDS min=5 default=5 max=200 ---+';
put dt nldatmmds.;
put dt nldatmmds5.;
put dt nldatmmds5.;
put dt nldatmmds200.;
run;
NLDATMMNw. Format
Writes the SAS datetime value as the name of the month that is appropriate for the current SAS locale.
Categories: CAS
Date
NLDATMMNw. Format 291
Syntax
NLDATMMNw.
Syntax Description
w
specifies the width of the output field.
Default 9
Range 4–200
Details
NLDATMMN writes values in a uniform pattern which ensures that the output has
the same pattern when using the same format width but different input data.
Example
This example uses the en_US locale option.
options locale=en_US;
data _null_;
dt = datetime();
dy = date();
put '+--- NLDATMMN min=5 default=10 max=200 ---+';
put dt nldatmmn.;
put dt nldatmmn4.;
put dt nldatmmn10.;
put dt nldatmmn200.;
run;
NLDATMSw. Format
Writes a SAS datetime value as the short representation of the date that is appropriate for the current SAS
locale.
Categories: CAS
Date and Time
Alignment: Left
Syntax
NLDATMSw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 19
Range 9–200
Details
NLDATMS writes the date in a short-uniform pattern with number and delimiters,
such as MM/DD/YYYY hh:mm:ss.
Example
This example uses the date April 12, 2019.
data _null_;
dt = datetime();
dy = date();
put '+--- NLDATMS min=9 default=19 max=200---+';
put dt nldatms.;
put dt nldatms10.;
put dt nldatms19.;
put dt nldatms200.;
run;
NLDATMTMw. Format 293
NLDATMTMw. Format
Writes the time portion of a SAS datetime value as a time of day that is appropriate for the current SAS
locale.
Categories: CAS
Date and Time
Time
Alignment: Left
Syntax
NLDATMTMw.
Syntax Description
w
specifies the width of the output field.
Default 16
Range 16–200
Comparisons
The NLDATMTMw. format is similar to the TODw. format, except that the
NLDATMTMw. format is locale-specific.
Example
These examples use the input value of 1361709583, which is the SAS datetime
value that corresponds to 12:39:43 p.m. on February 24, 2003.
This example specifies the English_United_States locale.
options locale=en_US;
data one;
294 Chapter 2 / Dictionary of Formats
event=1361709583;
put event nldatmtm.;
run;
12:39:43
12.39 Uhr
See Also
Formats:
n “NLDATMw. Format” on page 280
n “NLDATMAPw. Format” on page 281
n “NLDATMWw. Format” on page 295
NLDATMTZw. Format
Writes the time portion of the SAS datetime value as the time of day and time zone that is appropriate for
the current SAS locale.
Categories: CAS
Date and Time
Time
Alignment: Left
Syntax
NLDATMTZw.
Syntax Description
w
specifies the width of the output field.
NLDATMWw. Format 295
Default 32
Range 16–200
Example
This example uses the current datetime value. This example specifies the
French_France locale.
options locale=fr_FR;
data test;
x=datetime();
put x=nldatmtz.;
run;
x=10 h 08 -0400
NLDATMWw. Format
Writes SAS datetime values as the day of the week and the datetime that is appropriate for the current
SAS locale.
Categories: CAS
Date and Time
Alignment: Left
Syntax
NLDATMWw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the day of
week and datetime to fit the format width.
Default 41
Range 16–200
296 Chapter 2 / Dictionary of Formats
Details
The NLDATMW format might produce inaccurate localized output when using the
default width with some encoding and locale combinations because the date and
time names are too long. Please refer to Exceptions for Date and Time Default
Widths for information about recommended widths for locale and encoding
combinations. You might need to use the suggested width for the NLDATMW format.
NLDATMW writes the date value in a uniform pattern which ensures that the output
has the same pattern when using the same format width but different input data.
Comparisons
The NLDATMWw. format is similar to the TWMDYw. format, except that the
NLDATMWw. format is locale-specific.
Example
This example uses the input value of 1361709583, which is the SAS datetime value
that corresponds to 12:39:43 p.m. on February 24, 2003. This example specifies the
English_United States locale.
options locale=English_UnitedStates;
data one;
x=put(1361709583,nldatmw.);
y=put(1361709583,nldatmw30.);
z=put(1361709583,nldatmw200.);
put x=;
put y=;
put z=;
run;
See Also
Formats:
n “NLDATMw. Format” on page 280
n “NLDATMAPw. Format” on page 281
n “NLDATMTMw. Format” on page 293
NLDATMWNw. Format 297
NLDATMWNw. Format
Writes a SAS datetime value as the day of the week that is appropriate for the current SAS locale.
Categories: CAS
Date and Time
Alignment: Left
Syntax
NLDATMWNw.
Syntax Description
w
specifies the width of the output field.
Default 9
Range 4–200
Details
NLDATMWN writes the date value in a uniform pattern which ensures that the
output has the same pattern when using the same format width but different input
data.
Example
This example writes the SAS datetime value as a day of the week. This example
specifies the English_United States locale, which is the default SAS session
encoding.
data _null_;
dt = datetime();
dy = date();
put '+--- NLDATMWN min=4 default=9 max=200 ---+';
put dt nldatmwn;
put dt nldatmwn4.;
put dt nldatmwn9.;
put dt nldatmwn200.;
run;
298 Chapter 2 / Dictionary of Formats
NLDATMWZw. Format
Writes SAS date values as day-of-week, datetime, and time zone values that are appropriate.
Categories: CAS
Date
Date and Time
Alignment: Left
Syntax
NLDATMWZw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the day of
week and datetime to fit the format width.
Default 40
Range 16–200
Details
The NLDATMWZ format might produce inaccurate localized output when using the
default width with some encoding and locale combinations because the date and
time names are too long. Please refer to Exceptions for Date and Time Default
Widths for information about recommended widths for locale and encoding
combinations. You might need to use the recommended width.
Example
This example uses the current datetime value. This example specifies the
French_France locale.
options locale=fr_FR;
NLDATMYMw. Format 299
data test;
x=datetime();
put x=nldatmwz.;
run;
NLDATMYMw. Format
Writes the SAS datetime value as the month and year that is appropriate for the current SAS locale.
Categories: CAS
Date and Time
Alignment: Left
Syntax
NLDATMYMw.
Syntax Description
w
specifies the width of the output field.
Default 16
Range 6–200
Example
This example uses the en_US locale option.
options locale=en_US;
data _null_;
x=put(86400,nldatmym.);
y=put(86400,nldatmym12.);
put x=;
put y=;
run;
x=January 1960
y=January 1960
300 Chapter 2 / Dictionary of Formats
See Also
Format:
n “NLDATMMDw. Format” on page 286
NLDATMYMLw. Format
Writes a SAS date value as the month and the year that is appropriate for the current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATMYMLw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 14
Range 5–200
Details
NLDATMYML writes the date in a long-uniform pattern with full length of the month
and year, such as November 2012.
Example
The following example uses the date April 16, 2019.
data _null_;
dt = datetime();
put '+--- NLDATMYML min=5 default=14 max=200 ---+';
put dt nldatmyml.;
put dt nldatmyml7.;
put dt nldatmyml11.;
NLDATMYMMw. Format 301
put dt nldatmyml14.;
put dt nldatmyml200.;
run;
NLDATMYMMw. Format
Writes a SAS date value as the month and the year that is appropriate for the current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATMYMMw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 11
Range 5–200
Details
NLDATMYMM writes the date in a medium-uniform pattern with abbreviations of the
month and year, such as Nov 2012.
Example
The following example uses the date April 16, 2019.
data _null_;
302 Chapter 2 / Dictionary of Formats
dt = datetime();
dy = date();
put '+--- NLDATMYMM min=5 default=11 max=200 ---+';
put dt nldatmymm.;
put dt nldatmymm7.;
put dt nldatmymm11.;
put dt nldatmymm200.;
run;
NLDATMYMSw. Format
Writes a SAS date value as the month and year with numbers and a delimiter that is appropriate for the
current SAS locale.
Categories: CAS
Date
Alignment: Left
Syntax
NLDATMYMSw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 7
Range 5–200
Details
NLDATMYMS writes the date in a short-uniform pattern with numbers and a
delimiter for the month and year, such as 11/2012.
NLDATMYQw. Format 303
Example
The following example uses the date April 16, 2019.
data _null_;
dt = datetime();
dy = date();
put '+--- NLDATMYMS min=5 default=7 max=200 ---+';
put dt nldatmyms.;
put dt nldatmyms5.;
put dt nldatmyms7.;
put dt nldatmyms200.;
run;
NLDATMYQw. Format
Writes the SAS datetime value as the quarter and the year that is appropriate for the current SAS locale.
Categories: CAS
Date and Time
Alignment: Left
Syntax
NLDATMYQw.
Syntax Description
w
specifies the width of the output field.
Default 16
Range 4–200
Details
The NLDATMYQ format might produce inaccurate localized output when using the
default width with some encoding and locale combinations because the date and
304 Chapter 2 / Dictionary of Formats
time names are too long. Please refer to Exceptions for Date and Time Default
Widths for information about recommended widths for locale and encoding
combinations. You might need to use the recommended width.
Example
This example uses the en_US locale option.
options locale=en_US;
data _null_;
dy=today();
dt=datetime();
put "+--- NLDATMYQ min=4 default=16 max=200 ---+";
put ' 16' +5 dt nldatmyq.;
put ' 4' +5 dt nldatmyq4.;
put ' 14' +5 dt nldatmyq14.;
put ' 32' +5 dt nldatmyq32.;
put '200' +5 dt nldatmyq200.;
run;
NLDATMYQLw. Format
Writes a SAS date value as the year’s quarter value (1–4) and the year that is appropriate for the current
SAS locale.
Category: Date
Alignment: Left
Syntax
NLDATMYQLw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
NLDATMYQMw. Format 305
Default 18
Range 4–200
Details
NLDATMYQL writes the date in a long uniform pattern in full length of the year’s
quarter and then the year, such as 4th quarter 2012.
Example
The following example uses the date of April 16, 2019. This example specifies the
en_US locale.
options locale=en_US;
data _null_;
dt = datetime();
dy = date();
put '+--- NLDATMYQL min=4 default=18 max=200 ---+';
put dt nldatmyql.;
put dt nldatmyql6.;
put dt nldatmyql7.;
put dt nldatmyql18.;
put dt nldatmyql200.;
run;
NLDATMYQMw. Format
Writes a SAS date value as the year’s quarter (1–4) and the year that is appropriate for the current SAS
locale.
Categories: CAS
Date
Alignment: Left
306 Chapter 2 / Dictionary of Formats
Syntax
NLDATMYQMw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 7
Range 4–200
Details
NLDATMYQM writes the date in a medium-uniform pattern of the year’s quarter and
then the year, such as Q2 2019.
Example
The following example uses the date of April 16, 2019.
data _null_;
dt = datetime();
dy = date();
put '+--- NLDATMYQM min=4 default=7 max=200 ---+';
put dt nldatmyqm.;
put dt nldatmyqm6.;
put dt nldatmyqm7.;
put dt nldatmyqm200.;
run;
NLDATMYQSw. Format
Writes a SAS date value as the year and the quarter (1-4) using numbers and a delimiter that is
appropriate for the current SAS locale.
Categories: CAS
NLDATMYQSw. Format 307
Date
Alignment: Left
Syntax
NLDATMYQSw.
Syntax Description
w
specifies the width of the output field. If necessary, SAS abbreviates the date to
fit the format width.
Default 6
Range 4–200
Details
NLDATMYQS writes the date in a short-uniform pattern of the year and year’s
quarter value using numbers and a delimiter, such as 2012/4.
Example
The following example uses the date April 16, 2019.
data _null_;
dt = datetime();
dy = date();
put '+--- NLDATMYQS min=4 default=6 max=200 ---+';
put dt nldatmyqs.;
put dt nldatmyqs4.;
put dt nldatmyqs6.;
put dt nldatmyqs200.;
run;
NLDATMYRw. Format
Writes the SAS datetime value as the year that is appropriate for the current SAS locale.
Categories: CAS
Date and Time
Alignment: Left
Syntax
NLDATMYRw.
Syntax Description
w
specifies the width of the output field.
Default 16
Range 2–200
Example
This example uses the en_US locale option, which is the default SAS session
encoding.
data _null_;
dt = datetime();
dy = date();
put '+--- NLDATMYR min=2 default=16 max=200 ---+';
put dt nldatmyr.;
put dt nldatmyr2.;
put dt nldatmyr32.;
put dt nldatmyr200.;
run;
NLDATMYWw. Format
Writes the SAS datetime value as the week number and the year that is appropriate for the current SAS
locale.
Categories: CAS
Date and Time
Alignment: Left
Syntax
NLDATMYWw.
Syntax Description
w
specifies the width of the output field.
Default 16
Range 5–200
Example
This example uses the en_US locale option, which is the default SAS session
encoding.
data _null_;
dt = datetime();
dy = date();
put '+--- NLDATMYW min=5 default=16 max=200 ---+';
put ' 16' +5 dt nldatmyw.;
put ' 5' +5 dt nldatmyw5.;
put ' 8' +5 dt nldatmyw8.;
put ' 32' +5 dt nldatmyw32.;
put '200' +5 dt nldatmyw200.;
run;
NLDATMZw. Format
Writes SAS datetime values as datetime and time zone values that are appropriate for the current SAS
locale.
Categories: CAS
Date and Time
Alignment: Left
Syntax
NLDATMZw.
Syntax Description
w
specifies the width of the output field.
Default 40
Range 16–200
Example
This example uses the current datetime value. This example specifies the fr_FR
locale.
options locale=fr_FR;
data test;
x=datetime();
put x=nldatmz.;
run;
NLMNIAEDw.d Format
Writes the monetary format of the international expression for the United Arab Emirates.
Categories: CAS
Numeric
NLMNIAEDw.d Format 311
Alignment: Left
Syntax
NLMNIAEDw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 3
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmniaed32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLAEDx.d Format” on page 354
312 Chapter 2 / Dictionary of Formats
NLMNIAUDw.d Format
Writes the monetary format of the international expression for Australia.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNIAUDw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmniaud32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLAUDw.d Format” on page 355
NLMNIBGNw.d Format
Writes the monetary format of the international expression for Bulgaria.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNIBGNw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnibgn32.2);
y=put(-1234.56789,dollar32.2);
314 Chapter 2 / Dictionary of Formats
Statements Results
----+----1----+
See Also
Format:
n “NLMNLBGNw.d Format” on page 356
NLMNIBRLw.d Format
Writes the monetary format of the international expression for Brazil.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNIBRLw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
NLMNICADw.d Format 315
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnibrl32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLBRLw.d Format” on page 357
NLMNICADw.d Format
Writes the monetary format of the international expression for Canada.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNICADw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
316 Chapter 2 / Dictionary of Formats
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnicad32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLCADw.d Format” on page 358
NLMNICHFw.d Format
Writes the monetary format of the international expression for Liechtenstein and Switzerland.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNICHFw.d
NLMNICNYw.d Format 317
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnichf32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLCHFw.d Format” on page 359
NLMNICNYw.d Format
Writes the monetary format of the international expression for China.
Categories: CAS
Numeric
Alignment: Left
318 Chapter 2 / Dictionary of Formats
Syntax
NLMNICNYw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 02
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnicny32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLCNYw.d Format” on page 361
NLMNICZKw.d Format 319
NLMNICZKw.d Format
Writes the monetary format of the international expression for the Czech Republic.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNICZKw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 4
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmniczk32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLCZKw.d Format” on page 362
NLMNIDKKw.d Format
Writes the monetary format of the international expression for Denmark, Faroe Island, and Greenland.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNIDKKw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnidkk32.2);
y=put(-1234.56789,dollar32.2);
NLMNIEEKw.d Format 321
Statements Results
----+----1----+
See Also
Format:
n “NLMNLDKKw.d Format” on page 363
NLMNIEEKw.d Format
Writes the monetary format of the international expression for Estonia.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNIEEKw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 4
Range 0–28
322 Chapter 2 / Dictionary of Formats
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnieek32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLEEKw.d Format” on page 364
NLMNIEGPw.d Format
Writes the monetary format of the international expression for Egypt.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNIEGPw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
NLMNIEURw.d Format 323
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 3
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmniegp32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLEGPw.d Format” on page 365
NLMNIEURw.d Format
Writes the monetary format of the international expression for Austria, Belgium, Cyprus, Estonia, Finland,
France, Germany, Greece, Ireland, Italy, Latvia, Lithuania, Luxembourg, Malta, the Netherlands, Portugal,
Slovakia, Slovenia, and Spain.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNIEURw.d
324 Chapter 2 / Dictionary of Formats
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
Locale=German_Germany.
x=put(-1234.56789,nlmnieur32.2);
y=put(-1234.56789,nlmnleur32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLEURw.d Format” on page 366
NLMNIGBPw.d Format
Writes the monetary format of the international expression for the United Kingdom.
Categories: CAS
Numeric
Alignment: Left
NLMNIGBPw.d Format 325
Syntax
NLMNIGBPw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnigbp32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLGBPw.d Format” on page 368
326 Chapter 2 / Dictionary of Formats
NLMNIHKDw.d Format
Writes the monetary format of the international expression for Hong Kong.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNIHKDw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnihkd32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLHKDw.d Format” on page 369
NLMNIHRKw.d Format
Writes the monetary format of the international expression for Croatia.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNIHRKw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnihrk32.2);
y=put(-1234.56789,dollar32.2);
328 Chapter 2 / Dictionary of Formats
Statements Results
----+----1----+
See Also
Format:
n “NLMNLHRKw.d Format” on page 370
NLMNIHUFw.d Format
Writes the monetary format of the international expression for Hungary.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNIHUFw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
NLMNIIDRw.d Format 329
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnihuf32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLHUFw.d Format” on page 371
NLMNIIDRw.d Format
Writes the monetary format of the international expression for Indonesia.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNIIDRw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
330 Chapter 2 / Dictionary of Formats
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmniidr32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLIDRw.d Format” on page 372
NLMNIILSw.d Format
Writes the monetary format of the international expression for Israel.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNIILSw.d
NLMNIINRw.d Format 331
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 4
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmniils32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLILSw.d Format” on page 373
NLMNIINRw.d Format
Writes the monetary format of the international expression for India.
Categories: CAS
Numeric
Alignment: Left
332 Chapter 2 / Dictionary of Formats
Syntax
NLMNIINRw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmniinr32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLINRw.d Format” on page 375
NLMNIJPYw.d Format 333
NLMNIJPYw.d Format
Writes the monetary format of the international expression for Japan.
Category: Numeric
Alignment: Left
Syntax
NLMNIJPYw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 0
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnijpy32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLJPYw.d Format” on page 376
NLMNIKRWw.d Format
Writes the monetary format of the international expression for South Korea.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNIKRWw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 0
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnikrw32.2);
y=put(-1234.56789,dollar32.2);
NLMNILTLw.d Format 335
Statements Results
----+----1----+
See Also
Format:
n “NLMNLKRWw.d Format” on page 377
NLMNILTLw.d Format
Writes the monetary format of the international expression for Lithuania.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNILTLw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 4
Range 0–28
336 Chapter 2 / Dictionary of Formats
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmniltl32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLLTLw.d Format” on page 378
NLMNILVLw.d Format
Writes the monetary format of the international expression for Latvia.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNILVLw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
NLMNIMOPw.d Format 337
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 4
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnilvl32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLLVLw.d Format” on page 379
NLMNIMOPw.d Format
Writes the monetary format of the international expression for Macau.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNIMOPw.d
338 Chapter 2 / Dictionary of Formats
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnimop32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLMOPw.d Format” on page 380
NLMNIMXNw.d Format
Writes the monetary format of the international expression for Mexico.
Categories: CAS
Numeric
Alignment: Left
NLMNIMXNw.d Format 339
Syntax
NLMNIMXNw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnimxn32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLMXNw.d Format” on page 382
340 Chapter 2 / Dictionary of Formats
NLMNIMYRw.d Format
Writes the monetary format of the international expression for Malaysia.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNIMYRw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnimyr32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLMYRw.d Format” on page 383
NLMNINOKw.d Format
Writes the monetary format of the international expression for Norway.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNINOKw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmninok32.2);
y=put(-1234.56789,dollar32.2);
342 Chapter 2 / Dictionary of Formats
Statements Results
----+----1----+
See Also
Format:
n “NLMNLNOKw.d Format” on page 384
NLMNINZDw.d Format
Writes the monetary format of the international expression for New Zealand.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNINZDw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
NLMNIPLNw.d Format 343
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmninzd32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLNZDw.d Format” on page 385
NLMNIPLNw.d Format
Writes the monetary format of the international expression for Poland.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNIPLNw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
344 Chapter 2 / Dictionary of Formats
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnipln32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLPLNw.d Format” on page 386
NLMNIRUBw.d Format
Writes the monetary format of the international expression for Russia.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNIRUBw.d
NLMNISEKw.d Format 345
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnirub32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLRUBw.d Format” on page 387
NLMNISEKw.d Format
Writes the monetary format of the international expression for Sweden.
Categories: CAS
Numeric
Alignment: Left
346 Chapter 2 / Dictionary of Formats
Syntax
NLMNISEKw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnisek32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLSEKw.d Format” on page 389
NLMNISGDw.d Format 347
NLMNISGDw.d Format
Writes the monetary format of the international expression for Singapore.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNISGDw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnisgd32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLSGDw.d Format” on page 390
NLMNITHBw.d Format
Writes the monetary format of the international expression for Thailand.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNITHBw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnithb32.2);
y=put(-1234.56789,dollar32.2);
NLMNITRYw.d Format 349
Statements Results
----+----1----+
See Also
Format:
n “NLMNLTHBw.d Format” on page 391
NLMNITRYw.d Format
Writes the monetary format of the international expression for Turkey.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNITRYw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 4
Range 0–28
350 Chapter 2 / Dictionary of Formats
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnitry32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLTRYw.d Format” on page 392
NLMNITWDw.d Format
Writes the monetary format of the international expression for Taiwan.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNITWDw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
NLMNIUSDw.d Format 351
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnitwd32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLTWDw.d Format” on page 393
NLMNIUSDw.d Format
Writes the monetary format of the international expression for Puerto Rico and the United States.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNIUSDw.d
352 Chapter 2 / Dictionary of Formats
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmniusd32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLUSDw.d Format” on page 394
NLMNIZARw.d Format
Writes the monetary format of the international expression for South Africa.
Categories: CAS
Numeric
Alignment: Left
NLMNIZARw.d Format 353
Syntax
NLMNIZARw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnizar32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNLZARw.d Format” on page 396
354 Chapter 2 / Dictionary of Formats
NLMNLAEDx.d Format
Writes the monetary format of the local expression for the United Arab Emirates.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLAEDw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 3
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlaed32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNIAEDw.d Format” on page 310
NLMNLAUDw.d Format
Writes the monetary format of the local expression for Australia.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLAUDw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlaud32.2);
y=put(-1234.56789,dollar32.2);
356 Chapter 2 / Dictionary of Formats
Statements Results
----+----1----+
See Also
Format:
n “NLMNIAUDw.d Format” on page 312
NLMNLBGNw.d Format
Writes the monetary format of the local expression for Bulgaria.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLBGNw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
NLMNLBRLw.d Format 357
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlbgn32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNIBGNw.d Format” on page 313
NLMNLBRLw.d Format
Writes the monetary format of the local expression for Brazil.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLBRLw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
358 Chapter 2 / Dictionary of Formats
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlbrl32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNIBRLw.d Format” on page 314
NLMNLCADw.d Format
Writes the monetary format of the local expression for Canada.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLCADw.d
NLMNLCHFw.d Format 359
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlcad32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNICADw.d Format” on page 315
NLMNLCHFw.d Format
Writes the monetary format of the local expression for Liechtenstein and Switzerland.
Categories: CAS
Numeric
Alignment: Left
360 Chapter 2 / Dictionary of Formats
Syntax
NLMNLCHFw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlchf32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNICHFw.d Format” on page 316
NLMNLCNYw.d Format 361
NLMNLCNYw.d Format
Writes the monetary format of the local expression for China.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLCNYw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlcny32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNICNYw.d Format” on page 317
NLMNLCZKw.d Format
Writes the monetary format of the local expression for the Czech Republic.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLCZKw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 4
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlczk32.2);
y=put(-1234.56789,dollar32.2);
NLMNLDKKw.d Format 363
Statements Results
----+----1----+
See Also
Format:
n “NLMNICZKw.d Format” on page 319
NLMNLDKKw.d Format
Writes the monetary format of the local expression for Denmark, Faroe Island, and Greenland.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLDKKw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
364 Chapter 2 / Dictionary of Formats
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnldkk32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNIDKKw.d Format” on page 320
NLMNLEEKw.d Format
Writes the monetary format of the local expression for Estonia.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLEEKw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
NLMNLEGPw.d Format 365
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 4
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnleek32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNIEEKw.d Format” on page 321
NLMNLEGPw.d Format
Writes the monetary format of the local expression for Egypt.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLEGPw.d
366 Chapter 2 / Dictionary of Formats
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 3
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlegp32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNIEGPw.d Format” on page 322
NLMNLEURw.d Format
Writes the monetary format of the local expression for Austria, Belgium, Cyprus, Estonia, Finland, France,
Germany, Greece, Ireland, Italy, Latvia, Lithuania, Luxembourg, Malta, the Netherlands, Portugal, Slovakia,
Slovenia, and Spain.
Categories: CAS
Numeric
NLMNLEURw.d Format 367
Alignment: Left
Syntax
NLMNLEURw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to German_Germany.
x=put(-1234.56789,nlmnieur32.2);
y=put(-1234.56789,nlmnleur32.2);
Statements Results
----+----1----+----2----+
See Also
Format:
n “NLMNIEURw.d Format” on page 323
368 Chapter 2 / Dictionary of Formats
NLMNLGBPw.d Format
Writes the monetary format of the local expression for the United Kingdom.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLGBPw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlgbp32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNIGBPw.d Format” on page 324
NLMNLHKDw.d Format
Writes the monetary format of the local expression for Hong Kong.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLHKDw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlhkd32.2);
y=put(-1234.56789,dollar32.2);
370 Chapter 2 / Dictionary of Formats
Statements Results
----+----1----+
See Also
Format:
n “NLMNIHKDw.d Format” on page 326
NLMNLHRKw.d Format
Writes the monetary format of the local expression for Croatia.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLHRKw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
NLMNLHUFw.d Format 371
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlhrk32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNIHRKw.d Format” on page 327
NLMNLHUFw.d Format
Writes the monetary format of the local expression for Hungary.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLHUFw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
372 Chapter 2 / Dictionary of Formats
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlhuf32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNIHUFw.d Format” on page 328
NLMNLIDRw.d Format
Writes the monetary format of the local expression for Indonesia.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLIDRw.d
NLMNLILSw.d Format 373
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value..
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlidr32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNIIDRw.d Format” on page 329
NLMNLILSw.d Format
Writes the monetary format of the local expression for Israel.
Categories: CAS
Numeric
Alignment: Left
374 Chapter 2 / Dictionary of Formats
Syntax
NLMNLILSw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 4
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlils32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNIILSw.d Format” on page 330
NLMNLINRw.d Format 375
NLMNLINRw.d Format
Writes the monetary format of the local expression for India.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLINRw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlinr32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNIINRw.d Format” on page 331
NLMNLJPYw.d Format
Writes the monetary format of the international expression for Japan.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLJPYw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 0
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnljpy32.2);
y=put(-1234.56789,dollar32.2);
NLMNLKRWw.d Format 377
Statements Results
----+----1----+
See Also
Format:
n “NLMNIJPYw.d Format” on page 333
NLMNLKRWw.d Format
Writes the monetary format of the local expression for South Korea.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLKRWw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 0
Range 0–28
378 Chapter 2 / Dictionary of Formats
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlkrw32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNIKRWw.d Format” on page 334
NLMNLLTLw.d Format
Writes the monetary format of the local expression for Lithuania.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLLTLw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
NLMNLLVLw.d Format 379
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 4
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlltl32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNILTLw.d Format” on page 335
NLMNLLVLw.d Format
Writes the monetary format of the local expression for Latvia.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLLVLw.d
380 Chapter 2 / Dictionary of Formats
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 4
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnllvl32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNILVLw.d Format” on page 336
NLMNLMOPw.d Format
Writes the monetary format of the local expression for Macau.
Categories: CAS
Numeric
Alignment: Left
NLMNLMOPw.d Format 381
Syntax
NLMNLMOPw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlmop32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNIMOPw.d Format” on page 337
382 Chapter 2 / Dictionary of Formats
NLMNLMXNw.d Format
Writes the monetary format of the local expression for Mexico.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLMXNw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlmxn32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNIMXNw.d Format” on page 338
NLMNLMYRw.d Format
Writes the monetary format of the local expression for Malaysia.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLMYRw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlmyr32.2);
y=put(-1234.56789,dollar32.2);
384 Chapter 2 / Dictionary of Formats
Statements Results
----+----1----+
See Also
Format:
n “NLMNIMYRw.d Format” on page 340
NLMNLNOKw.d Format
Writes the monetary format of the local expression for Norway.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLNOKw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
NLMNLNZDw.d Format 385
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlnok32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNINOKw.d Format” on page 341
NLMNLNZDw.d Format
Writes the monetary format of the local expression for New Zealand.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLNZDw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
386 Chapter 2 / Dictionary of Formats
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlnzd32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNINZDw.d Format” on page 342
NLMNLPLNw.d Format
Writes the monetary format of the local expression for Poland.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLPLNw.d
NLMNLRUBw.d Format 387
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlpln32.2);
y=put(-1234.56789,dollar32.2)
Statements Results
----+----1----+
See Also
Format:
n “NLMNIPLNw.d Format” on page 343
NLMNLRUBw.d Format
Writes the monetary format of the local expression for Russia.
Categories: CAS
Numeric
Alignment: Left
388 Chapter 2 / Dictionary of Formats
Syntax
NLMNLRUBw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlrub32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNIRUBw.d Format” on page 344
NLMNLSEKw.d Format 389
NLMNLSEKw.d Format
Writes the monetary format of the local expression for Sweden.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLSEKw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlsek32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNISEKw.d Format” on page 345
NLMNLSGDw.d Format
Writes the monetary format of the local expression for Singapore.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLSGDw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlsgd32.2);
y=put(-1234.56789,dollar32.2);
NLMNLTHBw.d Format 391
Statements Results
----+----1----+
See Also
Format:
n “NLMNISGDw.d Format” on page 347
NLMNLTHBw.d Format
Writes the monetary format of the local expression for Thailand.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLTHBw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
392 Chapter 2 / Dictionary of Formats
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlthb32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNITHBw.d Format” on page 348
NLMNLTRYw.d Format
Writes the monetary format of the local expression for Turkey.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLTRYw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
NLMNLTWDw.d Format 393
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 4
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnltry32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNITRYw.d Format” on page 349
NLMNLTWDw.d Format
Writes the monetary format of the local expression for Taiwan.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLTWDw.d
394 Chapter 2 / Dictionary of Formats
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnltwd32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNITWDw.d Format” on page 350
NLMNLUSDw.d Format
Writes the monetary format of the local expression for Puerto Rico and the United States.
Categories: CAS
Numeric
Alignment: Left
NLMNLUSDw.d Format 395
Syntax
NLMNLUSDw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlusd32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNIUSDw.d Format” on page 351
396 Chapter 2 / Dictionary of Formats
NLMNLZARw.d Format
Writes the monetary format of the local expression for South Africa.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNLZARw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 8–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 2
Range 0–28
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnlzar32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNIZARw.d Format” on page 352
NLMNYw.d Format
Writes the monetary format of the local expression that is appropriate for the current SAS locale.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLMNYw.d
Syntax Description
w
specifies the width of the output field.
Default 9
Range 1–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 0
Range 0–31
Details
The NLMNYw.d informat reads integer binary (fixed-point) values, including
negative values that are represented in two's-complement notation. The NLMNYw.d
format writes numeric values by using the currency symbol, the thousands
separator, and the decimal separator that is used by the locale.
Note: The NLMNYw.d format does not convert currency format. Therefore, the
value of the formatted number should equal the currency of the current locale value.
398 Chapter 2 / Dictionary of Formats
Comparisons
The NLMNYw.d and NLMNYIw.d formats write the monetary format with locale-
dependent thousands and decimal separators. However, the NLMNYIw.d format
uses three-letter international currency codes, such as USD, while NLMNYw.d
format uses local currency symbols, such as $.
The NLMNYw.d format is similar to the DOLLARw.d format, except that the
NLMNYw.d format is locale-specific.
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmny32.2);
y=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNYIw.d Format” on page 398
Informats:
n “NLMNYw.d Informat” in SAS National Language Support (NLS): Reference
Guide
n “NLMNYIw.d Informat” in SAS National Language Support (NLS): Reference
Guide
NLMNYIw.d Format
Writes the monetary format of the international expression that is appropriate for the current SAS locale.
Categories: CAS
Numeric
Alignment: Left
NLMNYIw.d Format 399
Syntax
NLMNYIw.d
Syntax Description
w
specifies the width of the output field.
Default 9
Range 1–32
d
specifies the number of digits to the right of the decimal point in the numeric
value.
Default 0
Range 0–31
Details
The NLMNYIw.d informat reads integer binary (fixed-point) values, including
negative values that are represented in two's-complement notation. The
NLMNYIw.d format writes numeric values by using the international currency code,
and locale-dependent thousands and decimal separators. The position of
international currency code is also locale dependent.
Note: The NLMNYIw.d format does not convert currency format. Therefore, the
value of the formatted number should equal the currency of the current locale value.
Comparisons
The NLMNYw.d and NLMNYIw.d formats write the monetary format with locale-
dependent thousands and decimal separators. However, the NLMNYIw.d format
uses three-letter international currency codes, such as USD, while NLMNYw.d
format uses local currency symbols, such as $.
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-1234.56789,nlmnyi32.2);
y=put(-1234.56789,nlmny32.2);
400 Chapter 2 / Dictionary of Formats
z=put(-1234.56789,dollar32.2);
Statements Results
----+----1----+
See Also
Format:
n “NLMNYw.d Format” on page 397
Informats:
n “NLMNYw.d Informat” in SAS National Language Support (NLS): Reference
Guide
n “NLMNYIw.d Informat” in SAS National Language Support (NLS): Reference
Guide
NLNUMw.d Format
Writes the numeric format of the local expression that is appropriate for the current SAS locale.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLNUMw.d
Syntax Description
w
specifies the width of the output field.
Default 6
Range 1–32
NLNUMw.d Format 401
d
specifies to divide the number by 10 d. If the data contains decimal separators,
the d value is ignored.
Default 0
Range 0–31
Details
The NLMUMw.d informat reads integer binary (fixed-point) values, including
negative values that are represented in two's-complement notation. The NLNUMw.d
format writes numeric values by using the thousands separator and the decimal
separator that is used by the locale.
Comparisons
The NLNUMw.d format writes the numeric value with locale-dependent thousand
and decimal separators. The NLNUMIw.d format writes the numeric value with a
comma (,) as thousands separator and a period (.) as a decimal separator.
If the w or d values are not large enough to generate a formatted number, the
NLNUMw.d format uses an algorithm that prints the thousands-separator characters
whenever possible, even if some decimal precision is lost.
Example
x=put(-1234356.7891,nlnum32.2);
Statements Results
----+----1----+
put x=;
put x=;
See Also
Format:
n “NLNUMIw.d Format” on page 402
402 Chapter 2 / Dictionary of Formats
Informats:
n “NLNUMw.d Informat” in SAS National Language Support (NLS): Reference
Guide
n “NLNUMIw.d Informat” in SAS National Language Support (NLS): Reference
Guide
NLNUMIw.d Format
Writes the numeric format of the international expression that is appropriate for the current SAS locale.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLNUMIw.d
Syntax Description
w
specifies the width of the output field.
Default 6
Range 1–32
d
specifies to divide the number by 10 d. If the data contains decimal points, the d
value is ignored.
Default 0
Range 0–31
Details
The NLNUMIw.d informat reads integer binary (fixed-point) values, including
negative values that are represented in two's-complement notation. The
NLNUMIw.d format writes numeric values by using a comma (,) as thousands
separator and a period (.) as a decimal separator for all locales.
NLPCTw.d Format 403
Comparisons
The NLNUMIw.d format writes the numeric data of the international expression in
the specified locale. The NLNUMIw.d format writes the numeric value with a comma
(,) as thousands separator and a period (.) as a decimal separator.
If the w or d values are not large enough to generate a formatted number, the
NLNUMw.d format uses an algorithm that prints the thousands-separator characters
whenever possible, even if some decimal precision is lost.
Example
x=put(-1234356.7891,nlnumi32.2);
Statements Results
----+----1----+
put x=;
put x=;
See Also
Format:
n “NLNUMw.d Format” on page 400
Informats:
n “NLNUMw.d Informat” in SAS National Language Support (NLS): Reference
Guide
n “NLNUMIw.d Informat” in SAS National Language Support (NLS): Reference
Guide
NLPCTw.d Format
Writes percentage data of the local expression that is appropriate for the current SAS locale.
Categories: CAS
Numeric
Alignment: Left
404 Chapter 2 / Dictionary of Formats
Syntax
NLPCTw.d
Syntax Description
w
specifies the width of the output field.
Default 6
Range 4–32
d
specifies to divide the number by 10 d. If the data contains decimal separators,
the d value is ignored.
Default 0
Range 0–31
Comparisons
The NLPCTw.d format writes percentage data of the local expression in the
specified locale. The NLPCTw.d format writes the percentage value with locale-
dependent thousand and decimal separators. The NLPCTIw.d format writes the
percentage value with a comma (,) as thousands separator and a period (.) as a
decimal separator.
The NLPCTw.d format is similar to the PERCENTw.d format except the NLPCTw.d
format is locale-specific.
Example
x=put(-12.3456789,nlpct32.2);
y=put(-12.3456789,nlpcti32.2);
z=put(-12.3456789,percent32.2);
Statements Results
----+-----------1
put z=;
Statements Results
put x=; -1,234.57%
put z=;
See Also
Format:
n “NLPCTIw.d Format” on page 405
Informats:
n “NLPCTw.d Informat” in SAS National Language Support (NLS): Reference
Guide
n “NLPCTIw.d Informat” in SAS National Language Support (NLS): Reference
Guide
NLPCTIw.d Format
Writes percentage data of the international expression that is appropriate for the current SAS locale.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLPCTIw.d
Syntax Description
w
specifies the width of the output field.
Default 6
Range 4–32
d
specifies to divide the number by 10 d. If the data contains decimal separators,
the d value is ignored.
406 Chapter 2 / Dictionary of Formats
Default 0
Range 0–31
Comparisons
The NLPCTIw.d format writes percentage data of the international expression in the
specified locale. The NLPCTw.d format writes the percentage value with locale-
dependent thousand and decimal separators. The NLPCTIw.d format writes the
percentage value with a comma (,) as thousands separator and a period (.) as a
decimal separator.
The NLPCTw.d format is similar to the PERCENTw.d format except the NLPCTw.d
format is locale-specific.
Example
In the following example, the LOCALE= system option is set to
English_UnitedStates.
x=put(-12.3456789,nlpcti32.2);
y=put(-12.3456789,percent32.2);
Statements Results
----+--------1
See Also
Format:
n “NLPCTw.d Format” on page 403
Informats:
n “NLPCTw.d Informat” in SAS National Language Support (NLS): Reference
Guide
n “NLPCTIw.d Informat” in SAS National Language Support (NLS): Reference
Guide
NLPCTNw.d Format 407
NLPCTNw.d Format
Writes percentages, using a minus sign for negative values.
Categories: CAS
Numeric
Alignment: Right
Syntax
NLPCTNw.d
Syntax Description
w
specifies the width of the output field.
Default 6
Range 4–32
Tip The width of the output field must account for the minus sign ( – ), the
percent sign ( % ), and a trailing blank, whether the number is negative
or positive.
d
specifies the number of digits to the right of the decimal point in the numeric
value. This argument is optional.
Default 0
Range 0–31
Details
The NLPCTNw.d format multiplies negative values by 100, adds a minus sign to the
beginning of the value, and adds a percent sign (%) to the end of the formatted
value.
Example
x=-0.02;
408 Chapter 2 / Dictionary of Formats
Statements Results
NLPCTPw.d Format
Writes locale-specific numeric values as percentages.
Categories: CAS
Numeric
Alignment: Right
Syntax
NLPCTPw.d
Syntax Description
w
specifies the width of the output field.
Default 6
Range 4–32
Tip The width of the output field must account for the percent sign (% ).
d
specifies the number of digits to the right of the decimal point in the numeric
value. This argument is optional. The thousands separator and decimal symbol
for the NLPCTP format is locale-specific.
Default 0
Range 0–31
Details
The NLPCTPw.d format multiplies values by 100, formats them, and adds a percent
sign (%) to the end of the formatted value. The NLPCTPw.d format is similar to the
NLPVALUEw.d Format 409
The PERCENTw.d format, except that the thousands separator and decimal symbol
for the NLPCTPw.d format is locale-specific.
Example
x=-0.02;
Statements Results
NLPVALUEw.d Format
Writes p-values of the local expression that is appropriate for the current SAS locale.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLPVALUEw.d
Syntax Description
w
specifies the width of the output field.
Default 6
Range 3–32
d
specifies to divide the number by 10 d. If the data contains decimal separators,
the d value is ignored.
Default 4
Range 1–30
410 Chapter 2 / Dictionary of Formats
Example
This example uses the german_Germany locale option.
Statements:
options locale=german_germany;
data _null_;
put "+--- nlpvalue min=3 default=6 max=32 ---+";
x=0.1248;
put x= +5 x pvalue. +5 x nlpvalue.;
put x= +5 x pvalue3.1 +5 x nlpvalue3.1;
put x= +5 x pvalue20.2 +5 x nlpvalue20.2;
put x= +5 x pvalue32.3 +5 x nlpvalue32.3;
run;
Results:
+--- nlpvalue min=3 default=6 max=32 ---+
x=0.1248 0.1248 0,1248
x=0.1248 0.1 0,1
x=0.1248 0.12 0,12
x=0.1248 0.125 0,125
See Also
Format:
n “PVALUEw.d Format” on page 436
NLSTRMONw.d Format
Writes the month name that is appropriate for the current SAS locale.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLSTRMONw.d
Syntax Description
w
specifies the width of the output field
NLSTRMONw.d Format 411
Default 20
Range 1-200
d
specifies the following:
n 00000001: write abbreviated form.
Default 0
Range 0-3
Details
The NLSTRMONw.d format writes a SAS value, 1–12 as the name-of-the-month in
the specified locale. The following examples use the English_UnitedStates locale.
n 1 = the first month (January)
Example
This example uses the English_UnitedStates session encoding.
Statements Results
Data _null_ ;
January
monnum = 1 ; /* January=1,
December=12 */ Jan
Statements Results
NLSTRQTRw.d Format
Writes a numeric value as the quarter-of-the-year that is appropriate for the current SAS locale.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLSTRQTRw.d
Syntax Description
w
specifies the width of the output field
Default 20
Range 1–200
d
specifies the following:
n 00000001: write abbreviated form.
n 00000010: write capitalized form.
Default 0
Range 0–3
NLSTRWKw.d Format 413
Details
The NLSTRQTRw.d format writes a SAS value, 1–4 as the name-of-the-quarter for
the year in the specified locale. The following examples use the
English_UnitedStates locale.
n 1 = 1st quarter
n 2 = 2nd quarter
n 3 = 3rd quarter
n 4 = 4th quarter
Example
This example uses the English_UnitedStates session encoding.
Statements Results
Data _null_ ;
1st quarter
qtrnum = 1 ; /* January=1, December=12
*/ Q1
NLSTRWKw.d Format
Writes a numeric value as the day-of-the-week that is appropriate for the current SAS locale.
Categories: CAS
Numeric
Alignment: Left
Syntax
NLSTRWKw.d
414 Chapter 2 / Dictionary of Formats
Syntax Description
w
specifies the width of the output field
Default 20
Range 1–200
d
specifies the following:
n 00000001: write abbreviated form.
Default 0
Range 0–3
Details
The NLSTRWKw.d format writes a SAS value, 1–7 as the name-of-the-week in the
specified locale. The following examples use the English_UnitedStates locale.
n 1 = First day-of-week (Monday)
Example
This example uses the English_UnitedStates session encoding.
Statements Results
Data _null_ ;
Sunday
wknum = 1 ; /* Sunday=1, Saturday=7 */
Sun
put wknum NLSTRWK20. ;
SUNDAY
put wknum NLSTRWK20.1; /* decimal .1
specified use abbreviation. */ SUN
Statements Results
run;
NLTIMAPw. Format
Writes a SAS time value as a time value with a.m. or p.m. that is appropriate for the current SAS locale.
Categories: CAS
Date and Time
Time
Alignment: Left
Syntax
NLTIMAPw.
Syntax Description
w
specifies the width of the output field.
Default 10
Range 4–200
Details
The NLTIMAP format might produce inaccurate localized output when using the
default width with some encoding and locale combinations because the date and
time names are too long. Please refer to Exceptions for Date and Time Default
Widths for information about recommended widths for locale and encoding
combinations. You might need to use the recommended width.
Comparisons
The NLTIMAPw. format is similar to the TIMEAMPMw. format, except that the
NLTIMAPw. format is locale-specific.
NLTIMAP also writes datetime values.
416 Chapter 2 / Dictionary of Formats
Example
These examples use the input value of 59083, which is the SAS date-time value that
corresponds to 4:24:43 p.m.
Statements Results
----+----1----+
See Also
Format:
n “NLTIMEw. Format” on page 416
NLTIMEw. Format
Writes a SAS time value as a time value that is appropriate for the current SAS locale.
Categories: CAS
Date and Time
Time
Alignment: Left
Syntax
NLTIMEw.
Syntax Description
w
specifies the width of the input field.
Default 20
Range 10–200
NUMXw.d Format 417
Comparisons
The NLTIMEw. format is similar to the TIMEw. format, except that the NLTIMEw.
format is locale-specific.
NLTIME also writes datetime values.
Example
These examples use the input value of 59083, which is the SAS date-time value that
corresponds to 4:24:43 p.m.
Statements Results
----+----1----+
See Also
Format:
n “NLTIMAPw. Format” on page 415
NUMXw.d Format
Writes numeric values with a comma in place of the decimal point.
Category: Numeric
Alignment: Right
Restriction: This format is not supported in a DATA step that runs in CAS.
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
418 Chapter 2 / Dictionary of Formats
Syntax
NUMXw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 1–32
d
specifies the number of digits to the right of the decimal point (comma) in the
numeric value. This argument is optional.
Default 0
Range 0–31
Details
The NUMXw.d format writes numeric values with a comma in place of the decimal
point.
Comparisons
The NUMXw.d format is similar to the w.d format, except that NUMXw.d writes
numeric values with a comma in place of the decimal point.
Example
data one;
input x;
datalines;
896.48
64.89
3064.10
;
run;
data two;
set one;
put x numx10.2;
run;
OCTALw. Format 419
Value of x Result
----+----1----+
896.48 896,48
64.89 64,89
3064.10 3064,10
See Also
Formats:
n “w.d Format” on page 474
Informats:
n “NUMXw.d Informat” on page 652
OCTALw. Format
Converts numeric values to octal representation.
Categories: CAS
Numeric
Alignment: Left
Syntax
OCTALw.
Syntax Description
w
specifies the width of the output field.
Default 3
Range 1–24
420 Chapter 2 / Dictionary of Formats
Details
If necessary, the OCTALw. format converts numeric values to integers before
displaying them in octal representation.
Comparisons
OCTALw. converts numeric values to octal representation. The $OCTALw. format
converts character values to octal representation.
Example
data one;
x=3592;
put x octal6.;
run;
Value of x Result
----+----1
3592 007010
ODDSRw.d Format
Writes odds ratios.
Category: Numeric
Alignment: Right
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
OODSRw.d
Syntax Description
w
specifies the width of the output field.
ODDSRw.d Format 421
Default 8
Range 2–32
d
specifies the number of digits to the right of the decimal point in the numeric
value. This argument is optional.
Default 0
Range 0–30
Comparisons
The ODDSRw.d format follows the rules for the w.d format, except in these
conditions:
n values from –1e-12 to 10 -d –eps are displayed as less than “0.0...01”
n values that are greater than or equal to 10 w-d-2 are displayed as greater than
“999.999”
Example
data one;
input x;
datalines;
0.00001
0.0001
0.001
0.01
0.1
1
10
100
1000
I
_
M
.
-1
;
run;
data two;
set one;
put x oddsr8.3;
run;
422 Chapter 2 / Dictionary of Formats
Value of x Result
----+----1
0.00001 <0.001
0.0001 <0.001
0.001 0.001
0.01 0.010
0.1 0.100
1 1.000
10 10.000
100 100.000
1000 >999.999
I >999.999
. .
-1 ********
PDw.d Format
Writes data in packed decimal format.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
See: “PD Format: UNIX” in SAS Companion for UNIX Environments
“PDw.d Format: Windows” in SAS Companion for Windows
“PDw.d Format: z/OS” in SAS Companion for z/OS
PDw.d Format 423
Syntax
PDw.d
Syntax Description
w
specifies the width of the output field. The w value specifies the number of bytes,
not the number of digits. (In packed decimal data, each byte contains two digits.)
Default 1
Range 1–16
d
specifies to multiply the number by 10 d. This argument is optional.
Default 0
Range 0–31
Details
Different operating environments store packed decimal values in different ways.
However, the PDw.d format writes packed decimal values with consistent results if
the values are created in the same type of operating environment that you use to
run SAS.
The PDw.d format writes missing numerical data as –0. When the PDw.d informat
reads a –0, it stores it as 0.
Comparisons
The following table compares packed decimal notation in several programming
languages:
Language Notation
SAS PD4.
Example
data a;
x=128;
y=put(x,pd4.);
put y $hex8.;
run;
Value of x Result 1
----+----1
128 00000128
1 The result is a hexadecimal representation of a binary number written in packed decimal format.
Each byte occupies one column of the output field.
PDJULGw. Format
Writes packed Julian date values in the hexadecimal format yyyydddF for IBM.
Category: Date
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
PDJULGw.
Syntax Description
w
specifies the width of the output field.
Default 4
Range 3–16
Details
The PDJULGw. format writes SAS date values in the form yyyydddF.
yyyy
is the 2-byte representation of the four-digit Gregorian year.
PDJULGw. Format 425
ddd
is the 1 1/2-byte representation of the three-digit integer that corresponds to the
Julian day of the year, 1–365 (or 1–366 for leap years).
F
is the half-byte that contains all binary 1s, which assigns the value as positive.
Note: SAS interprets a two-digit year as part of the 100-year span that is defined by
the YEARCUTOFF= system option.
Example
date = '15sep2018'd;
juldate = put(date,pdjulg4.);
put juldate $hex8.;
run;
SAS writes the following results to the log:
20182587F
See Also
Formats:
n “JULDAYw. Format” on page 230
n “JULIANw. Format” on page 232
n “PDJULIw. Format” on page 426
Functions:
n “DATEJUL Function” in SAS Functions and CALL Routines: Reference
n “JULDATE Function” in SAS Functions and CALL Routines: Reference
Informats:
n “JULIANw. Informat” on page 643
n “PDJULGw. Informat” on page 656
n “PDJULIw. Informat” on page 658
System Options:
n “YEARCUTOFF= System Option” in SAS System Options: Reference
426 Chapter 2 / Dictionary of Formats
PDJULIw. Format
Writes packed Julian date values in the hexadecimal format ccyydddF for IBM.
Category: Date
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
PDJULIw.
Syntax Description
w
specifies the width of the output field.
Default 4
Range 3–16
Details
The PDJULIw. format writes SAS date values in the form ccyydddF.
cc
is the 1-byte representation of a two-digit integer that represents the century.
yy
is the 1-byte representation of a two-digit integer that represents the year. The
PDJULIw. format makes an adjustment for the century byte by subtracting 1900
from the four-digit Gregorian year to produce the correct packed decimal ccyy
representation. A year value of 1998 is stored in ccyy as 0098, and a year value
of 2011 is stored as 0111.
ddd
is the 1 1/2-byte representation of the three-digit integer that corresponds to the
Julian day of the year, 1–365 (or 1–366 for leap years).
F
is the half-byte that contains all binary 1s, which assigns the value as positive.
Note: SAS interprets a two-digit year as part of the 100-year span that is defined by
the YEARCUTOFF= system option.
PDJULIw. Format 427
Examples
Example 1
data _null_;
date = '15jun2018'd;
juldate = put(date,pdjuli4.);
put juldate $hex8.;
run;
SAS writes the following results to the log:
0118258F
Example 2
data _null_;
date = '31dec2018'd;
juldate = put(date,pdjuli4.);
put juldate $hex8.;
run;
SAS writes the following results to the log:
0118365F
See Also
Formats:
n “JULDAYw. Format” on page 230
n “JULIANw. Format” on page 232
n “PDJULGw. Format” on page 424
Functions:
n “DATEJUL Function” in SAS Functions and CALL Routines: Reference
n “JULDATE Function” in SAS Functions and CALL Routines: Reference
Informats:
n “JULIANw. Informat” on page 643
n “PDJULGw. Informat” on page 656
n “PDJULIw. Informat” on page 658
428 Chapter 2 / Dictionary of Formats
System Options:
n “YEARCUTOFF= System Option” in SAS System Options: Reference
PERCENTw.d Format
Writes numeric values as percentages.
Categories: CAS
Numeric
Alignment: Right
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
PERCENTw.d
Syntax Description
w
specifies the width of the output field.
Default 6
Range 4–32
Tip The width of the output field must account for the percent sign (% ) and
parentheses for numbers, whether the number is negative or positive.
d
specifies the number of digits to the right of the decimal point in the numeric
value. This argument is optional.
Range 0–31
Details
The PERCENTw.d format multiplies values by 100, formats them the same as the
BESTw.d format, and adds a percent sign (%) to the end of the formatted value.
Negative values are enclosed in parentheses.
PERCENTNw.d Format 429
Example
data one;
input gain;
datalines;
.1
1.2
-0.05
;
run;
data two;
set one;
put @10 gain percent10.;
run;
----+----1----+----2
0.1 10%
1.2 120%
-0.05 ( 5%)
See Also
Formats:
n “PERCENTNw.d Format” on page 429
PERCENTNw.d Format
Produces percentages, using a minus sign for negative values.
Categories: CAS
Numeric
Alignment: Right
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
430 Chapter 2 / Dictionary of Formats
Syntax
PERCENTNw.d
Syntax Description
w
specifies the width of the output field.
Default 6
Range 4–32
Tip The width of the output field must account for the minus sign ( – ), the
percent sign ( % ), and a trailing blank, whether the number is negative
or positive.
d
specifies the number of digits to the right of the decimal point in the numeric
value. This argument is optional.
Range 0–31
Details
The PERCENTNw.d format multiplies negative values by 100, formats them the
same as the BESTw.d format, adds a minus sign to the beginning of the value, and
adds a percent sign (%) to the end of the formatted value.
Comparisons
The PERCENTNw.d format produces percents by using a minus sign instead of
parentheses for negative values. The PERCENTw.d format produces percents by
using parentheses for negative values.
Example
data one;
input gain;
datalines;
-0.1
0.2
.8
-0.05
-6.3
PIBw.d Format 431
;
run;
data two;
set one;
put @10 gain percentn10.;
run;
–0.1 -10%
.2 20%
.8 80%
–0.05 -5%
–6.3 –630%
See Also
Format:
n “PERCENTw.d Format” on page 428
PIBw.d Format
Writes positive integer binary (fixed-point) values.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
See: “PIB Format: UNIX” in SAS Companion for UNIX Environments
“PIBw.d Format: Windows” in SAS Companion for Windows
Syntax
PIBw.d
432 Chapter 2 / Dictionary of Formats
Syntax Description
w
specifies the width of the output field.
Default 1
Range 1–8
d
specifies to multiply the number by 10 d. This argument is optional.
Default 0
Range 0–10
Details
All values are treated as positive. PIBw.d writes positive integer binary values with
consistent results if the values are created in the same type of operating
environment that you use to run SAS.
Comparisons
n Positive integer binary values are the same as integer binary values, except that
the sign bit is part of the value, which is always a positive integer. The PIBw.d
format treats all values as positive and includes the sign bit as part of the value.
n The PIBw.d format with a width of 1 results in a value that corresponds to the
binary equivalent of the contents of a byte. A value that corresponds to the
binary equivalent of the contents of a byte is useful if your data contains values
between hexadecimal 80 and hexadecimal FF, where the high-order bit can be
misinterpreted as a negative sign.
n The PIBw.d format is the same as the IBw.d format, except that PIBw.d treats all
values as positive values.
n The IBw.d and PIBw.d formats are used to write native format integers. (Native
format enables you to read and write values that are created in the same
operating environment.) The IBRw.d and PIBRw.d formats are used to write little
endian integers in any operating environment.
To view a table that shows the type of format to use with big endian and little
endian integers, see “Writing Data Generated on Big Endian and Little Endian
Platforms” on page 37.
PIBRw.d Format 433
Example
data _null_;
x=12;
y=put(x,pib1.);
put y $hex2.;
run;
Value of x Result 1
----+----1
12 0C
1 The result is a hexadecimal representation of a 1-byte binary number written in positive integer
binary format, which occupies one column of the output field.
See Also
Formats:
n “PIBRw.d Format” on page 433
PIBRw.d Format
Writes positive integer binary (fixed-point) values in Intel and DEC formats.
Category: Numeric
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
PIBRw.d
Syntax Description
w
specifies the width of the input field.
434 Chapter 2 / Dictionary of Formats
Default 1
Range 1–8
d
specifies to multiply the number by 10 d. This argument is optional.
Default 0
Range 0–10
Details
All values are treated as positive. PIBRw.d writes positive integer binary values that
have been generated by and for Intel and DEC operating environments. Use
PIBRw.d to write positive integer binary data from Intel or DEC environments in
other operating environments. The PIBRw.d format in SAS code allows for a
portable implementation for writing the data in any operating environment.
Comparisons
n Positive integer binary values are the same as integer binary values, except that
the sign bit is part of the value, which is always a positive integer. The PIBRw.d
format treats all values as positive and includes the sign bit as part of the value.
n The PIBRw.d format with a width of 1 results in a value that corresponds to the
binary equivalent of the contents of a byte. A value that corresponds to the
binary equivalent of the contents of a byte is useful if your data contains values
between hexadecimal 80 and hexadecimal FF, where the high-order bit can be
misinterpreted as a negative sign.
n In Intel and DEC operating environments, the PIBw.d and PIBRw.d formats are
equivalent.
n The IBw.d and PIBw.d formats are used to write native format integers. (Native
format enables you to read and write values that are created in the same
operating environment.) The IBRw.d and PIBRw.d formats are used to write little
endian integers in any operating environment.
To view a table that shows the type of format to use with big endian and little
endian integers, see “Writing Data Generated on Big Endian and Little Endian
Platforms” on page 37.
To view a table that compares integer binary notation in several programming
languages, see “Integer Binary Notation and Different Programming Languages”
on page 38.
PKw.d Format 435
Example
data _null_;
x=128;
y=put(x,pibr2.);
put y $hex4.;
run;
Value of x Result 1
----+----1
128 8000
1 The result is a hexadecimal representation of a two-byte binary number written in positive integer
binary format, which occupies one column of the output field.
See Also
Informats:
n “PIBw.d Informat” on page 662
PKw.d Format
Writes data in unsigned packed decimal format.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
PKw.d
Syntax Description
w
specifies the width of the output field.
Default 1
436 Chapter 2 / Dictionary of Formats
Range 1–16
d
specifies to multiply the number by 10 d. This argument is optional.
Default 0
Range 0–10
Details
Each byte of unsigned packed decimal data contains two digits.
Comparisons
The PKw.d format is similar to the PDw.d format, except that PKw.d does not write
the sign in the low-order byte.
Example
data _null_;
x=128;
y=put(x,pk4.);
put y $hex8.;
run;
Value of x Result 1
----+----1
128 00000128
1 The result is a hexadecimal representation of a 4-byte number written in packed decimal format.
Each byte occupies one column of the output field.
PVALUEw.d Format
Writes p-values.
Category: Numeric
Alignment: Right
PVALUEw.d Format 437
Restriction: This format is not supported in a DATA step that runs in CAS.
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
PVALUEw.d
Syntax Description
w
specifies the width of the output field.
Default 6
Range 3–32
d
specifies the number of digits to the right of the decimal point in the numeric
value. This argument is optional.
Range 1–30
Comparisons
The PVALUEw.d format follows the rules for the w.d format, except in these
conditions:
n if the value x is such that 0 <= x < 10 -d, x is printed as “<.0...01” with d–1 zeros
n missing values are printed as “.” unless you specify a different character by using
the MISSING= system option
Example
data one;
input x;
datalines;
.05
.000001
0
.0123456
;
438 Chapter 2 / Dictionary of Formats
run;
data two;
set one;
put x pvalue6.4;
run;
Value of x Result
----+----1
.05 0.0500
0.000001 <.0001
0 <.0001
.0123456 0.0123
QTRw. Format
Writes date values as the quarter of the year.
Categories: CAS
Date
Alignment: Right
Syntax
QTRw.
Syntax Description
w
specifies the width of the output field.
Default 1
Range 1–32
Example
data one;
QTRRw. Format 439
x='05mar2018'd;
put x qtr.;
run;
----+----1
put x qtr.; 1
See Also
Formats:
n “QTRRw. Format” on page 439
QTRRw. Format
Writes date values as the quarter of the year in Roman numerals.
Categories: CAS
Date
Alignment: Right
Syntax
QTRRw.
Syntax Description
w
specifies the width of the output field.
Default 3
Range 3–32
Example
data one;
x='05sep2018'd;
put x qtrr.;
440 Chapter 2 / Dictionary of Formats
run;
The example table uses the input value of 21432, which is the SAS date value that
corresponds to September 5, 2018.
----+----1
See Also
Formats:
n “QTRw. Format” on page 438
RBw.d Format
Writes real binary data (floating-point) in real binary format.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
See: “RB Format: UNIX” in SAS Companion for UNIX Environments
“RBw.d Format: Windows” in SAS Companion for Windows
“RBw.d Format: z/OS” in SAS Companion for z/OS
Syntax
RBw.d
Syntax Description
w
specifies the width of the output field.
Default 4
Range 2–8
d
specifies to multiply the number by 10 d. This argument is optional.
RBw.d Format 441
Default 0
Range 0–10
Details
The RBw.d format writes numeric data in the same way that SAS stores the data.
Because it requires no data conversion, RBw.d is the most efficient method for
writing data with SAS.
Note: Different operating environments store real binary values in different ways.
However, RBw.d writes real binary values with consistent results in the same type of
operating environment that you use to run SAS.
CAUTION
Using RB4. to write real binary data on equipment that conforms to the IEEE standard
for floating-point numbers results in a truncated 8-byte (double-precision) number rather
than a true 4-byte (single-precision) floating-point number.
Comparisons
The following table compares the names of real binary notation in several
programming languages:
C float double
Example
data one;
x=128;
y=put(x,rb8.);
put y $hex16.;
run;
442 Chapter 2 / Dictionary of Formats
Value of x Result 1
----+---1----+----2
128 0000000000006040
1 The result is a hexadecimal representation of an 8-byte real binary number as it looks on an IBM
mainframe. Each byte occupies one column of the output field.
ROMANw. Format
Writes numeric values as Roman numerals.
Categories: CAS
Numeric
Alignment: Left
Syntax
ROMANw.
Syntax Description
w
specifies the width of the output field.
Default 6
Range 2–32
Details
The ROMANw. format truncates a floating-point value to its integer component
before the value is written.
Example
data one;
input x;
datalines;
2018
52.3
S370FFw.d Format 443
;
run;
data two;
set one;
put x roman10.;
run;
Value of x Result
2018 MMXVIII
52.3 LII
S370FFw.d Format
Writes native standard numeric data in IBM mainframe format.
Category: Numeric
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
S370FFw.d
Syntax Description
w
specifies the width of the output field.
Default 12
Range 1–32
d
specifies the power of 10 by which to divide the value. This argument is optional.
Range 0–31
Details
The S370FFw.d format writes numeric data in IBM mainframe format (EBCDIC).
The EBCDIC numeric values are represented with 1 byte per digit. If EBCDIC is the
native format, S370FFw.d performs no conversion.
444 Chapter 2 / Dictionary of Formats
If a value is negative, an EBCDIC minus sign precedes the value. A missing value is
represented as a single EBCDIC period.
Comparisons
n On an EBCDIC system, S370FFw.d behaves like the w.d format.
n On all other systems, S370FFw.d performs the same role for numeric data that
the $EBCDICw. format does for character data.
Example
data _null_;
x=12345;
y=put(x,s370ff5.);
put y $hex10.;
run;
Value of x Result 1
----+----1
12345 F1F2F3F4F5
See Also
Formats:
n “$EBCDICw. Format” on page 109
n “w.d Format” on page 474
S370FIBw.d Format
Writes integer binary (fixed-point) values, including negative values, in IBM mainframe format.
Category: Numeric
Alignment: Left
S370FIBw.d Format 445
Syntax
S370FIBw.d
Syntax Description
w
specifies the width of the output field.
Default 4
Range 1–8
d
specifies to multiply the number by 10 d. This argument is optional.
Default 0
Range 0–10
Details
The S370FIBw.d format writes integer binary (fixed-point) values that are stored in
IBM mainframe format, including negative values that are represented in two's-
complement notation. S370FIBw.d writes integer binary values with consistent
results if the values are created in the same type of operating environment that you
use to run SAS.
Use S370FIBw.d to write integer binary data in IBM mainframe format from data that
is created in other operating environments.
Comparisons
n If you use SAS on an IBM mainframe, S370FIBw.d and IBw.d are identical.
Example
data _null_;
x=128;
y=put(x,s370fib4.);
put y $hex8.;
run;
Value of x Result 1
----+----1
128 00000080
1 The result is a hexadecimal representation of a 4-byte integer binary number. Each byte occupies
one column of the output field.
See Also
Formats:
n “S370FIBUw.d Format” on page 446
n “S370FPIBw.d Format” on page 451
S370FIBUw.d Format
Writes unsigned integer binary (fixed-point) values in IBM mainframe format.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
S370FIBUw.d
Syntax Description
w
specifies the width of the output field.
Default 4
Range 1–8
S370FIBUw.d Format 447
d
specifies to multiply the number by 10 d. This argument is optional.
Default 0
Range 0–10
Details
The S370FIBUw.d format writes unsigned integer binary (fixed-point) values that are
stored in IBM mainframe format, including negative values that are represented in
two's-complement notation. Unsigned integer binary values are the same as integer
binary values, except that all values are treated as positive. S370FIBUw.d writes
integer binary values with consistent results if the values are created in the same
type of operating environment that you use to run SAS.
Use S370FIBUw.d to write unsigned integer binary data in IBM mainframe format
from data that is created in other operating environments.
Comparisons
n The S370FIBUw.d format is equivalent to the COBOL notation PIC 9(n) BINARY,
where n is the number of digits.
n The S370FIBUw.d format is the same as the S370FIBw.d format, except that the
S370FIBUw.d format always uses the absolute value instead of the signed
value.
n The S370FPIBw.d format writes all negative numbers as FFs, whereas the
S370FIBUw.d format writes the absolute value.
n S370FPIBw.d, S370FIBUw.d, and S370FIBw.d are used to write big endian
integers in any operating environment.
To view a table that shows the type of format to use with big endian and little
endian integers, see “Writing Data Generated on Big Endian and Little Endian
Platforms” on page 37.
To view a table that compares integer binary notation in several programming
languages, see “Integer Binary Notation and Different Programming Languages”
on page 38.
Example
data one;
448 Chapter 2 / Dictionary of Formats
input x;
datalines;
245
-245
;
run;
data two;
set one;
y=put(x,s370fibu2.);
put y $hex4.;
run;
Value of x Result 1
245 F5
-245 F5
1 The result is a hexadecimal representation of a 1-byte integer binary number. Each byte occupies
one column of the output field.
See Also
Formats
n “S370FIBw.d Format” on page 444
n “S370FPIBw.d Format” on page 451
S370FPDw.d Format
Writes packed decimal data in IBM mainframe format.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
S370FPDw.d
S370FPDw.d Format 449
Syntax Description
w
specifies the width of the output field.
Default 1
Range 1–16
d
specifies to multiply the number by 10 d. This argument is optional.
Default 0
Range 0–31
Details
Use S370FPDw.d in other operating environments to write packed decimal data in
the same format as on an IBM mainframe computer.
Comparisons
The following table shows the notation for equivalent packed decimal formats in
several programming languages:
SAS S370FPD4.
Example
data _null_;
x=128;
y=put(x,s370fpd4.);
put y $hex8.;
run;
450 Chapter 2 / Dictionary of Formats
Value of x Result 1
----+----1
128 0000128C
1 The result is a hexadecimal representation of a binary number written in packed decimal format.
Each byte occupies one column of the output field.
S370FPDUw.d Format
Writes unsigned packed decimal data in IBM mainframe format.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
S370FPDUw.d
Syntax Description
w
specifies the width of the output field.
Default 1
Range 1–16
d
specifies to multiply the number by 10 d. This argument is optional.
Default 0
Range 0–31
Details
Use S370FPDUw.d in other operating environments to write unsigned packed
decimal data in the same format as on an IBM mainframe computer.
S370FPIBw.d Format 451
Comparisons
n The S370FPDUw.d format is similar to the S370FPDw.d format, except that the
S370FPDw.d format always uses the absolute value instead of the signed value.
n The S370FPDUw.d format is equivalent to the COBOL notation PIC 9(n)
PACKED-DECIMAL, where n is the number of digits.
Example
data one;
input x;
datalines;
123
-123
;
run;
data two;
set one;
y=put(x,s370fpdu4.);
put y $hex8.;
run;
Value of x Result 1
123 123F
-123 123F
1 The result is a hexadecimal representation of a binary number written in packed decimal format.
Each two hexadecimal characters correspond to 1 byte of binary data, and each byte corresponds to
one column of the output field.
S370FPIBw.d Format
Writes positive integer binary (fixed-point) values in IBM mainframe format.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
S370FPIBw.d
452 Chapter 2 / Dictionary of Formats
Syntax Description
w
specifies the width of the output field.
Default 4
Range 1–8
d
specifies to multiply the number by 10 d. This argument is optional.
Default 0
Range 0–10
Details
Positive integer binary values are the same as integer binary values, except that all
values are treated as positive. S370FPIBw.d writes integer binary values with
consistent results if the values are created in the same type of operating
environment that you use to run SAS.
Use S370FPIBw.d to write positive integer binary data in IBM mainframe format
from data that is created in other operating environments.
Comparisons
n If you use SAS on an IBM mainframe, S370FPIBw.d and PIBw.d are identical.
n The S370FPIBw.d format is the same as the S370FIBw.d format, except that the
S370FPIBw.d format treats all values as positive values.
n S370FPIBw.d, S370FIBUw.d, and S370FIBw.d are used to write big endian
integers in any operating environment.
To view a table that shows the type of format to use with big endian and little
endian integers, see “Writing Data Generated on Big Endian and Little Endian
Platforms” on page 37.
To view a table that compares integer binary notation in several programming
languages, see “Integer Binary Notation and Different Programming Languages”
on page 38.
S370FRBw.d Format 453
Example
data _null_;
x=12;
y=put(x,s370fpib1.);
put y $hex2.;
run;
Value of x Result 1
----+----1
12 0C
1 The result is a hexadecimal representation of a 1-byte binary number written in positive integer
binary format, which occupies one column of the output field.
See Also
Formats:
n “S370FIBw.d Format” on page 444
n “S370FIBUw.d Format” on page 446
S370FRBw.d Format
Writes real binary (floating-point) data in IBM mainframe format.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
S370FRBw.d
Syntax Description
w
specifies the width of the output field.
Default 4
Range 2–8
454 Chapter 2 / Dictionary of Formats
d
specifies to multiply the number by 10 d. This argument is optional.
Default 0
Range 0–10
Details
A floating-point value consists of two parts: a mantissa that gives the value and an
exponent that gives the value's magnitude.
Use S370FRBw.d in other operating environments to write floating-point binary data
in the same format as on an IBM mainframe computer.
Comparisons
The following table shows the notation for equivalent floating-point formats in
several programming languages:
C float double
Example
data _null_;
input x;
y=put(x,s370frb6.);
put y $hex8.;
datalines;
128
-128
;
run;
S370FZDw.d Format 455
Value of x Result 1
128 42800000
-123 C2800000
1 The result is a hexadecimal representation of a binary number in zoned decimal format on an IBM
mainframe computer. Each two hexadecimal characters correspond to 1 byte of binary data, and
each byte corresponds to one column of the output field.
S370FZDw.d Format
Writes zoned decimal data in IBM mainframe format.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
S370FZDw.d
Syntax Description
w
specifies the width of the output field.
Default 8
Range 1–32
d
specifies to multiply the number by 10 d. This argument is optional.
Default 0
Range 0–31
Details
Use S370FZDw.d in other operating environments to write zoned decimal data in
the same format as on an IBM mainframe computer.
456 Chapter 2 / Dictionary of Formats
Comparisons
The following table shows the notation for equivalent zoned decimal formats in
several programming languages:
SAS S370FZD3.
assembler ZL3
Example
data one;
input x;
datalines;
123
-123
;
run;
data two;
set one;
y=put(x,s370fzd3.);
put y $hex6.;
run;
Value of x Result 1
123 F1F2C3
-123 F1F2D3
1 The result is a hexadecimal representation of a binary number in zoned decimal format on an IBM
mainframe computer. Each two hexadecimal characters correspond to 1 byte of binary data, and
each byte corresponds to one column of the output field.
S370FZDLw.d Format
Writes zoned decimal leading-sign data in IBM mainframe format.
Category: Numeric
Alignment: Left
S370FZDLw.d Format 457
Restriction: This format is not supported in a DATA step that runs in CAS.
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
S370FZDLw.d
Syntax Description
w
specifies the width of the output field.
Default 8
Range 1–32
d
specifies to multiply the number by 10 d. This argument is optional.
Default 0
Range 0–31
Details
Use S370FZDLw.d in other operating environments to write zoned decimal leading-
sign data in the same format as on an IBM mainframe computer.
Comparisons
n The S370FZDLw.d format is similar to the S370FZDw.d format, except that the
S370FZDLw.d format displays the sign of the number in the first byte of the
formatted output.
n The S370FZDLw.d format is equivalent to the COBOL notation PIC S9(n)
DISPLAY SIGN LEADING, where n is the number of digits.
Example
data one;
input x;
datalines;
123
458 Chapter 2 / Dictionary of Formats
-123
;
run;
data two;
set one;
y=put(x,s370fzdl3.);
put y $hex6.;
run;
Value of x Result 1
123 C1F2F3
-123 D1F2F3
1 The result is a hexadecimal representation of a binary number in zoned decimal format on an IBM
mainframe computer. Each two hexadecimal characters correspond to 1 byte of binary data, and
each byte corresponds to one column of the output field.
S370FZDSw.d Format
Writes zoned decimal separate leading-sign data in IBM mainframe format.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
S370FZDSw.d
Syntax Description
w
specifies the width of the output field.
Default 8
Range 2–32
d
specifies to multiply the number by 10 d. This argument is optional.
Default 0
Range 0–31
S370FZDTw.d Format 459
Details
Use S370FZDSw.d in other operating environments to write zoned decimal separate
leading-sign data in the same format as on an IBM mainframe computer.
Comparisons
n The S370FZDSw.d format is similar to the S370FZDLw.d format except that the
S370FZDSw.d format does not embed the sign of the number in the zoned
output.
n The S370FZDSw.d format is equivalent to the COBOL notation PIC S9(n)
DISPLAY SIGN LEADING SEPARATE, where n is the number of digits.
Example
data one;
input x;
datalines;
123
-123
;
run;
data two;
set one;
y=put(x,s370fzds3.);
put y $hex6.;
run;
Value of x Result 1
123 4EF1F2F3
-123 60F1F2F3
1 The result is a hexadecimal representation of a binary number in zoned decimal format on an IBM
mainframe computer. Each two hexadecimal characters correspond to 1 byte of binary data, and
each byte corresponds to one column of the output field.
S370FZDTw.d Format
Writes zoned decimal separate trailing-sign data in IBM mainframe format.
Category: Numeric
Alignment: Left
460 Chapter 2 / Dictionary of Formats
Restriction: This format is not supported in a DATA step that runs in CAS.
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
S370FZDTw.d
Syntax Description
w
specifies the width of the output field.
Default 8
Range 2–32
d
specifies to multiply the number by 10 d. This argument is optional.
Default 0
Range 0–31
Details
Use S370FZDTw.d in other operating environments to write zoned decimal separate
trailing-sign data in the same format as on an IBM mainframe computer.
Comparisons
n The S370FZDTw.d format is similar to the S370FZDSw.d format except that the
S370FZDTw.d format displays the sign of the number at the end of the formatted
output.
n The S370FZDTw.d format is equivalent to the COBOL notation PIC S9(n)
DISPLAY SIGN TRAILING SEPARATE, where n is the number of digits.
Example
data one;
input x;
datalines;
123
S370FZDUw.d Format 461
-123
;
run;
data two;
set one;
y=put(x,s370fzdt4.);
put y $hex8.;
run;
Value of x Result 1
123 F1F2F34E
-123 F1F2F360
1 The result is a hexadecimal representation of a binary number in zoned decimal format on an IBM
mainframe computer. Each two hexadecimal characters correspond to 1 byte of binary data, and
each byte corresponds to one column of the output field.
S370FZDUw.d Format
Writes unsigned zoned decimal data in IBM mainframe format.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
S370FZDUw.d
Syntax Description
w
specifies the width of the output field.
Default 8
Range 1–32
d
specifies to multiply the number by 10 d. This argument is optional.
Default 0
462 Chapter 2 / Dictionary of Formats
Range 0–31
Details
Use S370FZDUw.d in other operating environments to write unsigned zoned
decimal data in the same format as on an IBM mainframe computer.
Comparisons
n The S370FZDUw.d format is similar to the S370FZDw.d format, except that the
S370FZDUw.d format always uses the absolute value of the number.
n The S370FZDUw.d format is equivalent to the COBOL notation PIC 9(n)
DISPLAY, where n is the number of digits.
Example
data one;
input x;
datalines;
123
-123
;
run;
data two;
set one;
y=put(x,s370fzdu3.);
put y $hex6.;
run;
Value of x Result 1
123 F1F2F3
-123 F1F2F3
1 The result is a hexadecimal representation of a binary number in zoned decimal format on an IBM
mainframe computer. Each pair of hexadecimal characters (such as F1) corresponds to 1 byte of
binary data, and each byte corresponds to one column of the output field.
SSNw. Format
Writes Social Security numbers.
TIMEw.d Format 463
Category: Numeric
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
SSNw.
Syntax Description
w
specifies the width of the output field.
Default 11
Restriction w must be 11
Details
If the value is missing, SAS writes nine single periods with hyphens between the
third and fourth periods and between the fifth and sixth periods. If the value contains
fewer than nine digits, SAS right-aligns the value and pads it with zeros on the left. If
the value has more than nine digits, SAS writes it as a missing value.
Example
data one;
id=263878439;
put id ssn.;
run;
Value of id Result
263878439 263-87-8439
TIMEw.d Format
Writes time values as hours, minutes, and seconds in the form hh:mm:ss.ss.
Categories: CAS
Time
Alignment: Right
464 Chapter 2 / Dictionary of Formats
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Note: The value of TIME can be a SAS time value, but it can also represent a time duration.
Therefore, the value of TIME can exceed 23:59:59, and it can also be a negative value.
Syntax
TIMEw.d
Syntax Description
w
specifies the width of the output field.
Default 8
Range 2–20
d
specifies the number of digits to the right of the decimal point in the seconds
value. This argument is optional.
Default 0
Range 0–19
Details
The TIMEw.d format writes SAS time values in the form hh:mm:ss.ss:
hh
is an integer.
Note: If hh is a single digit, TIMEw.d places a leading blank before the digit. For
example, the TIMEw.d. format writes 9:00 instead of 09:00.
mm
is an integer between 00 and 59 that represents minutes.
ss.ss
is the number of seconds between 00 and 59, with the fraction of a second
following the decimal point.
TIMEw.d Format 465
Comparisons
The TIMEw.d format is similar to the HHMMw.d format except that TIMEw.d
includes seconds.
The TIMEw.d format writes a leading blank for a single-hour digit. The TODw.d
format writes a leading 0 for a single-hour digit.
Examples
Example 1
data one;
mytime='16:24:43't;
put mytime time.;
run;
This example uses the input value of 59083, which is the SAS time value that
corresponds to 4:24:43 p.m.
----+----1
Example 2
data one;
mytime='8:00:00't *3;
put mytime time.;
run;
This example uses the input value of '8:00:00't and a multiplier of 3 for the total
(*3;), which indicates that the total time duration (such as 3 days of work) is 24
hours.
----+----1
Example 3
data one;
x='4:00:00't;
y='3:00:00't;
diff=y-x;
put diff time.;
run;
This example uses the input values of x='4:00:00't and y='3:00:00't and determines
that the value of y is one hour less than the value of x (diff = y-x;).
----+----1
See Also
Formats:
n “HHMMw.d Format” on page 221
n “HOURw.d Format” on page 224
n “MMSSw.d Format” on page 240
n “TODw.d Format” on page 468
Functions:
n “HOUR Function” in SAS Functions and CALL Routines: Reference
n “MINUTE Function” in SAS Functions and CALL Routines: Reference
n “SECOND Function” in SAS Functions and CALL Routines: Reference
n “TIME Function” in SAS Functions and CALL Routines: Reference
Informats:
n “TIMEw. Informat” on page 700
TIMEAMPMw.d Format
Writes time and datetime values as hours, minutes, and seconds in the form hh:mm:ss.ss with AM or PM.
Categories: CAS
Date and Time
Time
TIMEAMPMw.d Format 467
Alignment: Right
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
TIMEAMPMw.d
Syntax Description
w
specifies the width of the output field.
Default 11
Range 2–20
d
specifies the number of digits to the right of the decimal point in the seconds
value. This argument is optional.
Default 0
Range 0–19
Details
The TIMEAMPMw.d format writes SAS time values and SAS datetime values in the
form hh:mm:ss.ss with AM or PM. The letters h, m, and s are defined as follows:
hh
is an integer that represents the hour.
mm
is an integer that represents the minutes.
ss.ss
is the number of seconds to two decimal places.
Times greater than 23:59:59 PM appear as the next day.
Make w large enough to produce the desired results. To obtain a complete time
value with three decimal places and AM or PM, you must allow at least 11 spaces
(hh:mm:ss PM). If w is less than 5, SAS writes AM or PM only.
468 Chapter 2 / Dictionary of Formats
Comparisons
n The TIMEAMPMw.d format is similar to the TIMEw.d format, except that
TIMEAMPMw.d prints AM or PM at the end of the time.
n TIMEw.d writes hours greater than 23:59:59 PM, and TIMEAMPMw.d does not.
Example
data one;
begin='16:24:43't;
put begin timeampm3.;
put begin timeampm5.;
put begin timeampm8.;
put begin timeampm11.;
run;
The example table uses the input value of 59083, which is the SAS time value that
corresponds to 4:24:43 p.m.
----+----1----+
See Also
Formats:
n “TIMEw.d Format” on page 463
TODw.d Format
Writes SAS time values and the time portion of SAS datetime values in the form hh:mm:ss.ss.
Categories: CAS
Date and Time
Alignment: Right
TODw.d Format 469
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Note: You can specify a value greater than 24:00:00 for the TOD format, but it takes the MOD
of the value and 24:00:00. For example, if you give TOD a value of '25:00:00't, it formats
the value as 1:00:00.
Syntax
TODw.d
Syntax Description
w
specifies the width of the output field.
Default 8
Range 2–20
Tip SAS writes a 0 for a zero hour if the specified width is sufficient. For
example, the times 02:30 or 00:30 have a zero in the hour digits.
d
specifies the number of digits to the right of the decimal point in the seconds
value. This argument is optional.
Default 0
Range 0–19
Details
The TODw.d format writes SAS time and datetime values in the form hh:mm:ss.ss.
hh
is an integer that represents the hour.
mm
is an integer that represents the minutes.
ss.ss
is the number of seconds to two decimal places.
470 Chapter 2 / Dictionary of Formats
Comparisons
The TODw.d format writes a leading 0 for a single-hour digit. The TIMEw.d format
and the HHMMw.d format write a leading blank for a single-hour digit.
Examples
Example 1
data one;
mydt1='24aug2018 2:20:23 pm'dt;
mydt2='1:30't;
mydt3='8:54:43 am't;
put mydt1 tod5.;
put mydt2 tod9.;
put mydt3 tod9.;
run;
In this example, the SAS datetime value 1850739623 corresponds to August 24,
2018 at 2:20:23 p.m.
----+----1
Example 2
In this example, the SAS time value 32083 corresponds to 8:54:43 a.m.
data _null_;
begin = 32083;
put begin tod9.;
run;
----+----1
begin = 32083;
08:54:43
VAXRBw.d Format 471
See Also
Formats:
n “HHMMw.d Format” on page 221
n “TIMEw.d Format” on page 463
n “TIMEAMPMw.d Format” on page 466
Functions:
n “TIMEPART Function” in SAS Functions and CALL Routines: Reference
Informats:
n “TIMEw. Informat” on page 700
VAXRBw.d Format
Writes real binary (floating-point) data in VMS format.
Categories: CAS
Numeric
Alignment: Right
Syntax
VAXRBw.d
Syntax Description
w
specifies the width of the output field.
Default 8
Range 2–8
d
specifies the power of 10 by which to divide the value. This argument is optional.
Default 0
472 Chapter 2 / Dictionary of Formats
Range 0–31
Details
Use the VAXRBw.d format to write data in native VAX or VMS floating-point
notation.
Comparisons
If you use SAS that is running under VAX or VMS, the VAXRBw.d and RBw.d
formats are identical.
Example
data one;
x=1;
y=put(x,vaxrb8.);
put y $hex16.;
run;
Value of x Result 1
1 8040000000000000
VMSZNw.d Format
Generates VMS and MicroFocus COBOL zoned numeric data.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
VMSZNw.d
VMSZNw.d Format 473
Syntax Description
w
specifies the width of the output field.
Default 1
Range 1–32
d
specifies the number of digits to the right of the decimal point in the numeric
value. This argument is optional.
Details
The VMSZNw.d format is similar to the ZDw.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 between these
formats is in the special character that is used for the last digit. This table shows the
special characters that are used by the VMSZNw.d format.
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 w
8 8 –8 x
9 9 –9 y
If the value to be formatted is too large to fit in a field of the specified width, the
VMSZNw.d format handles values this way:
n For positive values, it sets the output to the largest positive number that fits in
the given width.
474 Chapter 2 / Dictionary of Formats
n For negative values, it sets the output to the negative number of greatest
magnitude that fits in the given width.
Example
data one;
x=1234;
put x vmszn4.;
put x vmszn5.1;
put x vmszn6.2;
put x vmszn5.;
run;
SAS writes the following results to the log:
----+----1
1234
12340
123400
01234
See Also
Formats:
n “ZDw.d Format” on page 520
Informats:
n “VMSZNw.d Informat” on page 706
w.d Format
Writes standard numeric data one digit per byte.
Categories: CAS
Numeric
Alignment: Right
Alias: Fw.d
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
w.d Format 475
Syntax
w.d
Syntax Description
w
specifies the width of the output field.
Range 1–32
Tip Allow enough space to write the value, the decimal point, and a minus
sign, if necessary.
d
specifies the number of digits to the right of the decimal point in the numeric
value. This argument is optional.
Range 0–31
Details
The w.d format rounds to the nearest number that fits in the output field. If w.d is too
small, SAS might shift the decimal to the BESTw. format. The w.d format writes
negative numbers with leading minus signs. In addition, w.d right-aligns before
writing and pads the output with leading blanks.
Comparisons
The Zw.d format is similar to the w.d format except that Zw.d pads right-aligned
output with 0s instead of blanks.
Example
data one;
x=23.45;
put x 6.3;
run;
SAS writes the following results to the log:
23.450
476 Chapter 2 / Dictionary of Formats
WEEKDATEw. Format
Writes date values as the day of the week and the date in the form day-of-week, month-name dd, yy (or
yyyy).
Category: Date
Alignment: Right
Restriction: Use the NLDATEw. format on the CAS server instead of the WEEKDATEw format.
Syntax
WEEKDATEw.
Syntax Description
w
specifies the width of the output field.
Default 29
Range 3–37
Details
The WEEKDATEw. format writes SAS date values in the form day-of-week, month-
name dd, yy (or yyyy):
dd
is an integer that represents the day of the month.
yy or yyyy
is a two-digit or four-digit integer that represents the year.
If w is too small to write the complete day of the week and month, SAS abbreviates
as needed.
Comparisons
The WEEKDATEw. format is the same as the WEEKDATXw. format, except that
WEEKDATXw. prints dd before the month's name.
WEEKDATEw. Format 477
Example
The example table uses the input value of 21349, which is the SAS date value that
corresponds to June 14, 2018.
data one;
mydate='14jun2018'd;
put mydate weekdate3.;
put mydate weekdate9.;
put mydate weekdate15.;
put mydate weekdate17.;
run;
----+----1----+----2
See Also
Formats:
n “DATEw. Format” on page 169
n “DDMMYYw. Format” on page 175
n “MMDDYYw. Format” on page 235
n “TODw.d Format” on page 468
n “WEEKDATXw. Format” on page 478
n “YYMMDDw. Format” on page 496
Functions:
n “JULDATE Function” in SAS Functions and CALL Routines: Reference
n “MDY Function” in SAS Functions and CALL Routines: Reference
n “WEEKDAY Function” in SAS Functions and CALL Routines: Reference
Informats:
n “DATEw. Informat” on page 615
n “DDMMYYw. Informat” on page 619
n “MMDDYYw. Informat” on page 647
478 Chapter 2 / Dictionary of Formats
WEEKDATXw. Format
Writes date values as the day of the week and date in the form day-of-week, dd month-name yy (or yyyy).
Categories: CAS
Date
Alignment: Right
Syntax
WEEKDATXw.
Syntax Description
w
specifies the width of the output field.
Default 29
Range 3–37
Details
The WEEKDATXw. format writes SAS date values in the form day-of-week, dd
month-name, yy (or yyyy):
dd
is an integer that represents the day of the month.
yy or yyyy
is a two-digit or a four-digit integer that represents the year.
If w is too small to write the complete day of the week and month, SAS abbreviates
as needed.
Comparisons
The WEEKDATEw. format is the same as the WEEKDATXw. format, except that
WEEKDATEw. prints dd after the month's name.
The WEEKDATXw. format is the same as the DTWKDATXw. format, except that
DTWKDATXw. expects a datetime value as input.
WEEKDATXw. Format 479
Example
The example table uses the input value of 21349, which is the SAS date value that
corresponds to June 14, 2018.
data one;
mydate='14jun2018'd;
put mydate weekdatx.;
run;
----+----1----+----2----+----3
See Also
Formats:
n “DATEw. Format” on page 169
n “DDMMYYw. Format” on page 175
n “DTWKDATXw. Format” on page 187
n “MMDDYYw. Format” on page 235
n “TODw.d Format” on page 468
n “WEEKDATEw. Format” on page 476
n “YYMMDDw. Format” on page 496
Functions:
n “JULDATE Function” in SAS Functions and CALL Routines: Reference
n “MDY Function” in SAS Functions and CALL Routines: Reference
n “WEEKDAY Function” in SAS Functions and CALL Routines: Reference
Informats:
n “DATEw. Informat” on page 615
n “DDMMYYw. Informat” on page 619
n “MMDDYYw. Informat” on page 647
n “YYMMDDw. Informat” on page 718
480 Chapter 2 / Dictionary of Formats
WEEKDAYw. Format
Writes date values as the day of the week.
Categories: CAS
Date
Alignment: Right
Syntax
WEEKDAYw.
Syntax Description
w
specifies the width of the output field.
Default 1
Range 1–32
Details
The WEEKDAYw. format writes a SAS date value as the day of the week (where
1=Sunday, 2=Monday, and so on).
Example
data one;
mydate='15sep2018'd;
put mydate weekday.;
run;
The example table uses the input value of 21442, which is the SAS date value that
corresponds to September 15, 2018.
----+----1
See Also
Formats:
n “DOWNAMEw. Format” on page 183
Functions
n “WEEKDAY Function” in SAS Functions and CALL Routines: Reference
WEEKUw. Format
Writes a week number in decimal format by using the U algorithm.
Category: Date
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
WEEKUw.
Syntax Description
w
specifies the width of the output field.
Default 11
Range 2–200
Details
The WEEKUw. format writes a week-number format. The WEEKUw. format writes
the various formats depending on the specified width. Algorithm U calculates the
SAS date value by using the number of the week within the year. (Sunday is
considered the first day of the week.) The number-of-the-week value is represented
as a decimal number in the range 0–53, with a leading 0 and maximum value of 53.
For example, the fifth week of the year would be represented as 05.
Here are widths, formats, and examples:
482 Chapter 2 / Dictionary of Formats
Comparisons
The WEEKVw. format writes the week number as a decimal number in the range
01–53. Weeks that begin on a Monday and week 1 of the year include January 4
and the first Thursday of the year. If the first Monday of January is 2, 3, or 4, the
preceding days are part of the last week of the preceding year. The WEEKWw.
format writes the week number of the year as a decimal number in the range 00–53,
with Monday as the first day of week 1. The WEEKUw. format writes the week
number of the year (with Sunday as the first day of the week) as a decimal number
in the range 0–53, with a leading 0.
Example
data one;
sasdate='16apr2018'd;
put sasdate weeku3.;
put sasdate weeku5.;
put sasdate weeku7.;
put sasdate weeku9.;
put sasdate weeku11.;
run;
Statement Result
----+----1----+
See Also
Formats:
n “WEEKVw. Format” on page 483
n “WEEKWw. Format” on page 485
Functions:
n “WEEK Function” in SAS Functions and CALL Routines: Reference
Informats:
n “WEEKUw. Informat” on page 709
n “WEEKVw. Informat” on page 711
n “WEEKWw. Informat” on page 714
WEEKVw. Format
Writes a week number in decimal format by using the V algorithm.
Category: Date
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
WEEKVw.
Syntax Description
w
specifies the width of the output field.
Default 11
Range 2–200
484 Chapter 2 / Dictionary of Formats
Details
The WEEKVw. format writes the various formats depending on the specified width.
Algorithm V calculates the SAS date value. The number-of-the-week value is
represented as a decimal number in the range 01–53, with a leading 0 and
maximum value of 53. Weeks begin on a Monday and week 1 of the year is the
week that includes both January 4 and the first Thursday of the year. If the first
Monday of January is 2, 3, or 4, the preceding days are part of the last week of the
preceding year. For example, the fifth week of the year would be represented as 06.
Here are the widths, formats, and examples:
Comparisons
The WEEKVw. format writes the week number as a decimal number in the range
01–53.Weeks that begin on a Monday and week 1 of the year include January 4 and
the first Thursday of the year. If the first Monday of January is 2, 3, or 4, the
preceding days are part of the last week of the preceding year. The WEEKWw.
format writes the week number of the year as a decimal number in the range 00–53,
with Monday as the first day of week 1. The WEEKUw. format writes the week
number of the year (with Sunday as the first day of the week) as a decimal number
in the range 0–53, with a leading 0.
Example
data one;
sasdate='16apr2018'd;
put sasdate weekv3.;
put sasdate weekv5.;
put sasdate weekv7.;
put sasdate weekv9.;
put sasdate weekv11.;
run;
WEEKWw. Format 485
Statement Result
----+----1----+
See Also
Formats:
n “WEEKUw. Format” on page 481
n “WEEKWw. Format” on page 485
Functions:
n “WEEK Function” in SAS Functions and CALL Routines: Reference
Informats:
n “WEEKUw. Informat” on page 709
n “WEEKVw. Informat” on page 711
n “WEEKWw. Informat” on page 714
WEEKWw. Format
Writes a week number in decimal format by using the W algorithm.
Category: Date
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
WEEKWw.
486 Chapter 2 / Dictionary of Formats
Syntax Description
w
specifies the width of the output field.
Default 11
Range 2–200
Details
The WEEKWw. format writes the various formats depending on the specified width.
Algorithm W calculates the SAS date value by using the number of the week within
the year. (Monday is considered the first day of the week.) The number-of-the-week
value is represented as a decimal number in the range 0–53, with a leading 0 and a
maximum value of 53. For example, the fifth week of the year would be represented
as 05.
Here are widths, formats, and examples:
Comparisons
The WEEKVw. format writes the week number as a decimal number in the range
01–53. Weeks that begin on a Monday and week 1 of the year include January 4
and the first Thursday of the year. If the first Monday of January is 2, 3, or 4, the
preceding days are part of the last week of the preceding year. The WEEKWw.
format writes the week number of the year as a decimal number in the range 00–53,
with Monday as the first day of week 1. The WEEKUw. format writes the week
number of the year (with Sunday as the first day of the week) as a decimal number
in the range 0–53, with a leading 0.
Example
data _null_;
WORDDATEw. Format 487
sasdate='16apr2018'd;
v=put(sasdate,weekw3.);
w=put(sasdate,weekw5.);
x=put(sasdate,weekw7.);
y=put(sasdate,weekw9.);
z=put(sasdate,weekw11.);
run;
Statement Result
----+----1----+
See Also
Formats:
n “WEEKUw. Format” on page 481
n “WEEKVw. Format” on page 483
Functions:
n “WEEK Function” in SAS Functions and CALL Routines: Reference
Informats:
n “WEEKUw. Informat” on page 709
n “WEEKVw. Informat” on page 711
n “WEEKWw. Informat” on page 714
WORDDATEw. Format
Writes date values as the name of the month, the day, and the year in the form month-name dd, yyyy.
Category: Date
Alignment: Right
488 Chapter 2 / Dictionary of Formats
Restriction: The WORDDATEw. format is not valid on the CAS server. Use the NLDATEw. format on
the CAS server instead of the WORDDATEw. format.
Syntax
WORDDATEw.
Syntax Description
w
specifies the width of the output field.
Default 18
Range 3–32
Details
The WORDDATEw. format writes SAS date values in the form month-name dd,
yyyy.
dd
is an integer that represents the day of the month.
yyyy
is a four-digit integer that represents the year.
If the width is too small to write the complete month, SAS abbreviates as necessary.
Comparisons
The WORDDATEw. format is the same as the WORDDATXw. format, except that
WORDDATXw. prints dd before the month's name.
Example
The example table uses the input value of 21349, which is the SAS date value that
corresponds to June 14, 2018.
data one;
mydate='14jun2018'd;
put mydate worddate3.;
put mydate worddate9.;
put mydate worddate12.;
put mydate worddate20.;
run;
WORDDATXw. Format 489
----+----1----+----2
June
put mydate worddate9.;
See Also
Formats:
n “WORDDATXw. Format” on page 489
WORDDATXw. Format
Writes date values as the day, the name of the month, and the year in the form dd month-name yyyy.
Category: Date
Alignment: Right
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
WORDDATXw.
Syntax Description
w
specifies the width of the output field.
Default 18
Range 3–32
490 Chapter 2 / Dictionary of Formats
Details
The WORDDATXw. format writes SAS date values in the form dd month-name,
yyyy:
dd
is an integer that represents the day of the month. For days 1–9, the leading 0 is
not displayed.
yyyy
is a four-digit integer that represents the year.
If the width is too small to write the complete month, SAS abbreviates as necessary.
Comparisons
The WORDDATXw. format is the same as the WORDDATEw. format, except that
WORDDATEw. prints dd after the month's name.
Example
The example table uses the input value of 21349, which is the SAS date value that
corresponds to June 14, 2018.
data one;
mydate='14jun2018'd;
put mydate worddatx.;
run;
----+----1----+----2
See Also
Formats:
n “WORDDATEw. Format” on page 487
WORDFw. Format 491
WORDFw. Format
Writes numeric values as words with fractions that are shown numerically.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
WORDFw.
Syntax Description
w
specifies the width of the output field.
Default 10
Range 5–32767
Details
The WORDFw. format converts numeric values to their equivalent in English words,
with fractions that are represented numerically in hundredths. For example, 8.2 is
printed as eight and 20/100.
Negative numbers are preceded by the word minus. When the value's equivalent in
words does not fit in the specified field, the word is truncated on the right and the
last character is printed as an asterisk.
Comparisons
The WORDFw. format is similar to the WORDSw. format, except that WORDFw.
prints fractions as numbers instead of words.
Example
data one;
value=2.5;
492 Chapter 2 / Dictionary of Formats
----+----1----+
See Also
Formats:
n “WORDSw. Format” on page 492
WORDSw. Format
Writes numeric values as words.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Syntax
WORDSw.
Syntax Description
w
specifies the width of the output field.
Default 10
Range 5–32767
Details
You can use the WORDSw. format to print checks with the amount written below the
payee line.
YEARw. Format 493
Negative numbers are preceded by the word minus. If the number is not an integer,
the fractional portion is represented as hundredths. For example, 5.3 is printed as
five and thirty hundredths. When the value's equivalent in words does not fit in the
specified field, the word is truncated on the right and the last character is printed as
an asterisk.
Comparisons
The WORDSw. format is similar to the WORDFw. format, except that WORDSw.
prints fractions as words instead of numbers.
Example
data one;
value=2.5;
put value words25.;
run;
Value Result
----+----1----+----2----+
See Also
Formats:
n “WORDFw. Format” on page 491
YEARw. Format
Writes date values as the year.
Categories: CAS
Date
Alignment: Right
494 Chapter 2 / Dictionary of Formats
Syntax
YEARw.
Syntax Description
w
specifies the width of the output field.
Default 4
Range 2–32
Tip If w is less than 4, the last two digits of the year are printed. Otherwise,
the year value is printed as four digits.
Details
The YEARw. format is similar to the DTYEARw. format in that they both write date
values. The difference is that YEARw. expects a SAS date value as input, and
DTYEARw. expects a datetime value.
Example
data one;
mydate='14jun2018'd;
put mydate year2.;
put mydate year4.;
run;
The example table uses the input value of 21349, which is the SAS date value that
corresponds to June 14, 2018.
----+----1
See Also
Formats:
YYMMw. Format 495
YYMMw. Format
Writes date values in the form <yy>yyMmm, where M is a character separator to indicate that the month
number follows the M and the year appears as either two or four digits.
Categories: CAS
Date
Alignment: Right
Syntax
YYMMw.
Syntax Description
w
specifies the width of the output field.
Default 7
Range 5–32
Interaction When w has a value of 5 or 6, the date appears with only the last
two digits of the year. When w is 7 or more, the date appears with a
four-digit year.
Details
The YYMMw. format writes SAS date values in the form <yy>yyMmm.
<yy>yy
is a two-digit or four-digit integer that represents the year.
M
is the character separator to indicate that the number of the month follows.
mm
is an integer that represents the month.
Example
data one;
mydate='14jun2018'd;
496 Chapter 2 / Dictionary of Formats
SAS Statement
Result
----+----1----+
20182M0610
put mydate yymm10.;
See Also
Formats:
n “MMYYw. Format” on page 241
n “YYMMxw. Format” on page 501
YYMMDDw. Format
Writes date values in the form yymmdd or <yy>yy-mm-dd, where a hyphen is the separator and the year
appears as either two or four digits.
Categories: CAS
Date
Alignment: Right
Syntax
YYMMDDw.
YYMMDDw. Format 497
Syntax Description
w
specifies the width of the output field.
Default 8
Range 2–10
Interaction When w has a value from 2 to 5, the date appears with as much of
the year and the month as possible. When w is 7, the date appears
as a two-digit year without hyphens.
Details
The YYMMDDw. format writes SAS date values in one of these forms:
yymmdd
<yy>yy–mm–dd
The letters and special character are defined as follows:
<yy>yy
is a two-digit or four-digit integer that represents the year.
–
is the separator.
mm
is an integer that represents the month.
dd
is an integer that represents the day of the month.
To format a date that has a four-digit year and no separators, use the YYMMDDx.
format.
Example
data one;
mydate='03apr2018'd;
put mydate yymmdd2.;
put mydate yymmdd3.;;
put mydate yymmdd4.;
put mydate yymmdd5.;
put mydate yymmdd6.;
put mydate yymmdd7.;
put mydate yymmdd8.;
put mydate yymmdd10.;
run;
The following examples use the input value of 21277, which is the SAS date value
that corresponds to April 3, 2018.
498 Chapter 2 / Dictionary of Formats
----+----1----+
See Also
Formats:
n “DATEw. Format” on page 169
n “DDMMYYw. Format” on page 175
n “MMDDYYw. Format” on page 235
n “YYMMDDxw. Format” on page 499
Functions:
n “DAY Function” in SAS Functions and CALL Routines: Reference
n “MDY Function” in SAS Functions and CALL Routines: Reference
n “MONTH Function” in SAS Functions and CALL Routines: Reference
n “YEAR Function” in SAS Functions and CALL Routines: Reference
Informats:
n “DATEw. Informat” on page 615
n “DDMMYYw. Informat” on page 619
n “MMDDYYw. Informat” on page 647
YYMMDDxw. Format 499
YYMMDDxw. Format
Writes date values in the form yymmdd or <yy>yy-mm-dd, where the x in the format name is a character
that represents the special character that separates the year, month, and day. The special character can
be a hyphen (-), period (.), blank character, slash (/), colon (:), or no separator. The year can be either two
or four digits.
Categories: CAS
Date
Alignment: Right
Syntax
YYMMDDxw.
Syntax Description
x
identifies a separator or specifies that no separator appear between the year, the
month, and the day. These are the valid values for x:
B
separates with a blank.
C
separates with a colon.
D
separates with a hyphen.
N
indicates no separator.
P
separates with a period.
S
separates with a slash.
w
specifies the width of the output field.
Default 8
Range 2–10
Interactions When w has a value from 2 to 5, the date appears with as much of
the year and the month. When w is 7, the date appears as a two-
digit year without separators.
Details
The YYMMDDxw. format writes SAS date values in one of these forms:
yymmdd
<yy>yyxmmxdd
The letters and special character are defined as follows:
<yy>yy
is a two-digit or four-digit integer that represents the year.
x
is a specified separator.
mm
is an integer that represents the month.
dd
is an integer that represents the day of the month.
Example
data one;
mydate='14may2018'd;
put mydate yymmddc5.;
put mydate yymmddd8.;;
put mydate yymmddp10.;
put mydate yymmddn8.;
run;
The following examples use the input value of 21318, which is the SAS date value
that corresponds to May 14, 2018.
----+----1----+
See Also
Formats:
n “DATEw. Format” on page 169
YYMMxw. Format 501
Functions:
n “DAY Function” in SAS Functions and CALL Routines: Reference
n “MDY Function” in SAS Functions and CALL Routines: Reference
n “MONTH Function” in SAS Functions and CALL Routines: Reference
n “YEAR Function” in SAS Functions and CALL Routines: Reference
Informats:
n “YYMMDDw. Informat” on page 718
YYMMxw. Format
Writes date values in the form <yy>yymm or <yy>yy-mm. The x in the format name represents the special
character that separates the year and the month. This special character can be a hyphen (-), period (.),
slash (/), colon (:), or no separator. The year can be either two or four digits.
Categories: CAS
Date
Alignment: Right
Syntax
YYMMxw.
Syntax Description
x
identifies a separator or specifies that no separator appear between the year and
the month. These are valid values for x:
C
separates with a colon.
D
separates with a hyphen.
N
indicates no separator.
P
separates with a period.
S
separates with a forward slash.
502 Chapter 2 / Dictionary of Formats
w
specifies the width of the output field.
Default 7
Range 5–32
Details
The YYMMxw. format writes SAS date values in one of these forms:
<yy>yymm
<yy>yyXmm
The letters are defined as follows:
<yy>yy
is a two-digit or four-digit integer that represents the year.
x
is a specified separator.
mm
is an integer that represents the month.
Example
The following examples use the input value of 2138, which is the SAS date value
that corresponds to May 14, 2018.
data one;
mydate='14may2018'd;
put mydate yymmc5.;
put mydate yymmd.;
put mydate yymmn4.;
put mydate yymmp8.;
put mydate yymms10.;
run;
YYMONw. Format 503
----+----1----+
See Also
Formats:
n “MMYYxw. Format” on page 243
n “YYMMw. Format” on page 495
YYMONw. Format
Writes date values in the form yymmm or yyyymmm.
Categories: CAS
Date
Numeric
Alignment: Right
Syntax
YYMONw.
Syntax Description
w
specifies the width of the output field. If the format width is too small to print a
four-digit year, only the last two digits of the year are printed.
Default 7
Range 5–32
504 Chapter 2 / Dictionary of Formats
Details
The YYMONw. format writes SAS date values in the form <yy>yymmm:
<yy>yy
is a two-digit or four-digit integer that represents the year.
mmm
is the name of the month, abbreviated to three characters.
Example
data one;
mydate='14jun2018'd;
put mydate yymon6.;
put mydate yymon7.;
run;
The example table uses the input value of 21349, which is the SAS date value that
corresponds to June 14, 2018.
----+----1
See Also
Formats:
n “MMYYw. Format” on page 241
YYQw. Format
Writes date values in the form <yy>yyQq, where Q is the separator, the year appears as either two or four
digits, and q is the quarter of the year.
Categories: CAS
Date
Alignment: Right
YYQw. Format 505
Syntax
YYQw.
Syntax Description
w
specifies the width of the output field.
Default 6
Range 4–32
Interaction When w has a value of 4 or 5, the date appears with only the last
two digits of the year. When w is 6 or more, the date appears with a
four-digit year.
Details
The YYQw. format writes SAS date values in the form <yy>yyQq.
<yy>yy
is a two-digit or four-digit integer that represents the year.
Q
is the character separator.
q
is an integer (1, 2, 3, or 4) that represents the quarter of the year.
Example
The following examples use the input value of 21349, which is the SAS date value
that corresponds to June 14, 2018.
data one;
mydate='14jun2018'd;
put mydate yyq.;
put mydate yyq4.;
put mydate yyq5.;
put mydate yyq6.;
put mydate yyq10.;
run;
----+----1----+
See Also
Formats:
n “YYQxw. Format” on page 506
n “YYQRw. Format” on page 508
YYQxw. Format
Writes date values in the form <yy>yyq or <yy>yy-q, where the x in the format name is a character that
represents the special character that separates the year and the quarter or the year. The special character
can be a hyphen (-), period (.), blank character, slash (/), colon (:), or no separator. The year can be either
two or four digits.
Categories: CAS
Date
Alignment: Right
Syntax
YYQxw.
Syntax Description
x
identifies a separator or specifies that no separator appear between the year and
the quarter. These are the valid values for x:
C
separates with a colon
D
separates with a hyphen
YYQxw. Format 507
N
indicates no separator
P
separates with a period
S
separates with a forward slash.
w
specifies the width of the output field.
Default 6
Range 4–32
When w has a value of 4 or 5, the date appears with only the last
two digits of the year. When w is 6 or more, the date appears with
a four-digit year.
Details
The YYQxw. format writes SAS date values in one of these forms:
<yy>yyq
<yy>yyxq
The letters and special character are defined as follows:
<yy>yy
is a two-digit or four-digit integer that represents the year.
x
is a specified separator.
q
is an integer (1, 2, 3, or 4) that represents the quarter of the year.
Example
The following examples use the input value of 21366, which is the SAS date value
that corresponds to July 01, 2018.
data one;
mydate='01jul2018'd;
put mydate yyqc4.;
put mydate yyqd.;
508 Chapter 2 / Dictionary of Formats
----+----1----+
See Also
Formats:
n “YYQw. Format” on page 504
n “YYQRxw. Format” on page 510
YYQRw. Format
Writes date values in the form <yy>yyQqr, where Q is the separator, the year appears as either two or four
digits, and qr is the quarter of the year expressed in Roman numerals.
Categories: CAS
Date
Alignment: Right
Syntax
YYQRw.
Syntax Description
w
specifies the width of the output field.
YYQRw. Format 509
Default 8
Range 6–32
Interaction When the value of w is too small to write a four-digit year, the date
appears with only the last two digits of the year.
Details
The YYQRw. format writes SAS date values in the form <yy>yyQqr.
<yy>yy
is a two-digit or four-digit integer that represents the year.
Q
is the character separator.
qr
is a Roman numeral (I, II, III, or IV) that represents the quarter of the year.
Example
The following examples use the input value of 21366, which is the SAS date value
that corresponds to July 01, 2018.
data one;
mydate='01jul2018'd;
put mydate yyqr.;
put mydate yyqr6.;
put mydate yyqr7.;
put mydate yyqr8.;
put mydate yyqr10.;
run;
----+----1----+
See Also
Formats:
n “YYQw. Format” on page 504
n “YYQRxw. Format” on page 510
YYQRxw. Format
Writes date values in the form <yy>yyqr or <yy>yy-qr, where the x in the format name is a character that
represents the special character. The special character separates the year and the quarter or the year. The
special character can be a hyphen (-), period (.), blank character, slash (/), colon (:), or no separator. The
year can be either two or four digits, and qr is the quarter of the year expressed in Roman numerals.
Categories: CAS
Date
Numeric
Alignment: Right
Syntax
YYQRxw.
Syntax Description
x
identifies a separator or specifies that no separator appear between the year and
the quarter. These are the valid values for x.
C
separates with a colon.
D
separates with a hyphen.
N
indicates no separator.
P
separates with a period.
S
separates with a forward slash.
w
specifies the width of the output field.
Default 8
Range 6–32
YYQRxw. Format 511
When the value of w is too small to write a four-digit year, the date
appears with only the last two digits of the year.
Details
The YYQRxw. format writes SAS date values in one of these forms:
<yy>yyqr
<yy>yyxqr
The letters and special character are defined as follows:
<yy>yy
is a two-digit or four-digit integer that represents the year.
x
is a specified separator.
qr
is a Roman numeral (I, II, III, or IV) that represents the quarter of the year.
Example
The following examples use the input value of 21318, which is the SAS date value
that corresponds to May 14, 2018.
data _null_;
input date anydtdte12.;
put date;
put date yyqrc6.;
put date yyqrd.;
put date yyqrn5.;
put date yyqrp8.;
put date yyqrs10.;
datalines;
05/14/2018
;
run;
----+----1----+
See Also
Formats:
n “YYQxw. Format” on page 506
n “YYQRw. Format” on page 508
YYQZw. Format
Writes SAS date values in the form <yy><qq>, the year appears as 2 or 4 digits, and qq is the quarter of
the year.
Categories: CAS
Date and Time
Alignment: Right
Syntax
YYQZw.
Required Arguments
Z
specifies that no separator appear between the year and the quarter.
w
specifies the width of the output field.
Default 4
Range 4–6
YYWEEKUw. Format 513
Details
The YYQZw. format writes SAS date values in the form <yy> <qq>. Here is an
explanation of the syntax:
<yy>
is a two-digit or four-digit integer that represents the year.
Z
specifies that there is no separator.
<qq>
is an integer (01, 02, 03, or 04) that represents the quarter of the year.
Example
The following examples use the input value of 20999. 20999 is the SAS date value
that corresponds to June 29, 2017.
data _null_;
declare char(20) a b;
method run();
a=put (20999,yyqz6.);
b=put (20999,yyqz4.);
put a= b=;
end;
enddata;
run;
SAS writes the following output to the log.
a=201702 b=1702
See Also
n “DS2 Expressions” in SAS DS2 Programmer’s Guide
Formats:
n “YYQw. Format” in SAS DS2 Language Reference
n “YYQxw. Format” in SAS DS2 Language Reference
n “YYQRw. Format” in SAS DS2 Language Reference
n “YYQRxw. Format” in SAS DS2 Language Reference
YYWEEKUw. Format
Writes a week number in decimal format by using the U algorithm, excluding day-of-the-week information.
514 Chapter 2 / Dictionary of Formats
Categories: CAS
Date and Time
Alignment: Left
Syntax
YYWEEKUw.
Syntax Description
w
specifies the width of the output field.
Default 7
Range 2-8
Details
The YYWEEKUw. format writes a week-number format. The YYWEEKUw. format
writes the various formats depending on the specified width. Algorithm U calculates
the SAS date value by using the number of the week within the year (Sunday is
considered the first day of the week).
For more information about widths, formats, and examples see the following table:
7 yyyyWww 2007W01
8 yyyy-Www 2007-W01
Comparisons
The YYWEEKUw. format is similar to the WEEKUw. format except that the
YYWEEKUw. format does not specify the day-of-week information. Also, the
YYWEEKUw. format does not accept any width that is greater than 8.
YYWEEKVw. Format 515
Example
sasdate = '01JAN2007'd;
Statements Results
----+----1----+
u=put(sasdate,yyweeku3.); W00
v=put(sasdate,yyweeku4.); W00
w=put(sasdate,yyweeku5.); 07W00
x=put(sasdate,yyweeku6.); 07W00
y=put(sasdate,yyweeku7.); 2007W00
z=put(sasdate,yyweeku8.); 2007-W00
put u;
put v;
put w;
put x;
put y;
put z;
See Also
Format:
n “WEEKUw. Format” in SAS National Language Support (NLS): Reference Guide
YYWEEKVw. Format
Writes a week number in decimal format by using the V algorithm, excluding day-of-the-week information.
Categories: CAS
Date and Time
Alignment: Left
Syntax
YYWEEKVw.
Syntax Description
w
specifies the width of the output field.
516 Chapter 2 / Dictionary of Formats
Default 7
Range 2–8
Details
The YYWEEKVw. format writes the various formats depending on the specified
width. Algorithm V calculates the SAS date value, and the number-of-the-week
value is represented as a decimal number in the range 01–53, with a leading 0 and
maximum value of 53. Weeks begin on a Monday and week 1 of the year is the
week that includes both January 4 and the first Thursday of the year. If the first
Monday of January is the 2nd, 3rd, or 4th, the preceding days are part of the last
week of the preceding year. For example, the fifth week of the year would be
represented as 06.
For more information about widths, formats, and examples see the following table:
7 yyyyWww 2007W01
8 yyyy-Www 2007-W01
Comparisons
The YYWEEKVw. format is similar to the WEEKVw. format except that the
YYWEEKVw. format does not specify the day-of-week information. Also, the
YYWEEKVw. format does not accept a width that is greater than 8.
Example
sasdate = '01JAN2007'd;
Statements Results
----+----1----+
u=put(sasdate,yyweekv3.); W01
v=put(sasdate,yyweekv4.); W01
YYWEEKWw. Format 517
Statements Results
w=put(sasdate,yyweekv5.); 07W01
x=put(sasdate,yyweekv6.); 07W01
y=put(sasdate,yyweekv7.); 2007W01
z=put(sasdate,yyweekv8.); 2007-W01
put u;
put v;
put w;
put x;
put y;
put z;
See Also
Format:
n “WEEKVw. Format” in SAS National Language Support (NLS): Reference Guide
YYWEEKWw. Format
Writes a week number in decimal format by using the W algorithm, excluding the day-of-week information.
Categories: CAS
Date and Time
Alignment: Left
Syntax
YYWEEKWw.
Syntax Description
w
specifies the width of the output field.
Default 7
Range 2–8
518 Chapter 2 / Dictionary of Formats
Details
The YYWEEKWw. format writes the various formats depending on the specified
width. Algorithm W calculates the SAS date value using the number of the week
within the year.
For more information about widths, formats, and examples see the following table:
7 yyyyWww 2007W01
8 yyyy-Www 2007-W01
Comparisons
The YYWEEKWw. format is similar to the WEEKWw. format except that the
YYWEEKWw. format does not specify the day-of-week information. Also, the
YYWEEKWw. format does not accept any width that is greater than 8.
Example
sasdate = '01JAN2007'd
Statements Results
----+----1----+
u=put(sasdate,yyweekw3.); W01
v=put(sasdate,yyweekw4.); W01
w=put(sasdate,yyweekw5.); 07W01
x=put(sasdate,yyweekw6.); 07W01
y=put(sasdate,yyweekw7.); 2007W01
z=put(sasdate,yyweekw8.); 2007-W01
put u;
put v;
put w;
put x;
put y;
put z;
Zw.d Format 519
See Also
Format:
n “WEEKWw. Format” in SAS National Language Support (NLS): Reference Guide
Zw.d Format
Writes standard numeric data with leading 0s.
Categories: CAS
Numeric
Alignment: Right
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
Syntax
Zw.d
Syntax Description
w
specifies the width of the output field.
Default 1
Range 1–32
Tip Allow enough space to write the value, the decimal point, and a minus
sign, if necessary.
d
specifies the number of digits to the right of the decimal point in the numeric
value. This argument is optional.
Default 0
Range 0–31
Tip If d is 0 or you omit d, Zw.d writes the value without a decimal point.
520 Chapter 2 / Dictionary of Formats
Details
The Zw.d format writes standard numeric values one digit per byte and fills in 0s to
the left of the data value.
The Zw.d format rounds to the nearest number that fits in the output field. If w.d is
too large to fit, SAS might shift the decimal to the BESTw. format. The Zw.d format
writes negative numbers with leading minus signs. In addition, it right-aligns before
writing and pads the output with leading 0s.
Comparisons
The Zw.d format is similar to the w.d format, except that Zw.d pads right-aligned
output with 0s instead of blanks.
Example
data one;
num=1350;
put num z8.;
run;
----+----1
1350 00001350
ZDw.d Format
Writes numeric data in zoned decimal format.
Category: Numeric
Alignment: Left
Restriction: This format is not supported in a DATA step that runs in CAS.
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written
using this format might differ slightly from previous releases. For more information, see
“DECIMALCONV= System Option” in SAS System Options: Reference.
See: “ZD Format: UNIX” in SAS Companion for UNIX Environments
“ZDw.d Format: Windows” in SAS Companion for Windows
“ZDw.d Format: z/OS” in SAS Companion for z/OS
ZDw.d Format 521
Syntax
ZDw.d
Syntax Description
w
specifies the width of the output field.
Default 1
Range 1–32
d
specifies to multiply the number by 10 d. This argument is optional.
Default 0
Range 0–31
Details
The zoned decimal format is similar to standard numeric format in that every digit
requires 1 byte. However, the value's sign is in the last byte, along with the last digit.
Delimiters are not supported in the PUT statement’s LIST output.
Comparisons
The following table compares the zoned decimal format with notation in several
programming languages:
SAS ZD3.
Example
data one;
num=1350;
put num zd8.;
run;
1350 0000135{
1 The result is a hexadecimal representation of a binary number in zoned decimal format on an IBM
mainframe computer. Each byte occupies one column of the output field.
523
PART 2
SAS Informats
Chapter 3
About Informats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
Chapter 4
Dictionary of Informats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545
524
525
3
About Informats
Definition of Informats
An informat is a type of SAS language element that applies a pattern to or executes
instructions for a data value to be read as input. Types of informats correspond to
the data's type: numeric, character, date, time, or timestamp. The ability to create
user-defined informats is also supported. Examples of SAS informats are BINARY,
526 Chapter 3 / About Informats
DATE. and COMMA. For example, the following value contains a dollar sign and
commas:
$1,000,000
To remove the dollar sign ($) and commas (,) before storing the numeric value
1000000 in a variable, read this value with the COMMA11. informat.
Unless you explicitly define a variable first, SAS uses the informat to determine
whether the variable is numeric or character. SAS also uses the informat to
determine the length of character variables.
Syntax
SAS informats have the following form:
<$>informat<w>.<d>
$
indicates a character informat; its absence indicates a numeric informat.
informat
names the informat. The informat is a SAS informat or a user-defined informat
that was previously defined with the INVALUE statement in PROC FORMAT.
“FORMAT Procedure” in Base SAS Procedures Guide.
w
specifies the informat width, which for most informats is the number of columns
in the input data.
d
specifies an optional decimal scaling factor in the numeric informats. SAS
divides the input data by 10 to the power of d.
Note: Even though SAS can read up to 32 digits when you specify some numeric
informats, numbers with more than 15 significant digits might lose precision due to
the limitations of the 8-byte floating-point representation used by most computers.
Informats always contain a period (.) as a part of the name. If you omit the w and d
values from the informat, SAS uses default values. If the data contains decimal
points, SAS ignores the d value and reads the number of decimal places that are
actually in the input data.
If the informat width is too narrow to read all the columns in the input data, you
might get unexpected results. The problem frequently occurs with the date and time
informats. You must adjust the width of the informat to include blanks or special
characters between the day, month, year, or time. For more information about date
and time values, see “Definitions for Dates, Times, and Intervals” on page 9.
When a problem occurs with an informat, SAS writes a note to the SAS log and
assigns a missing value to the variable. Problems occur if you use an incompatible
informat such as a numeric informat to read character data, or if you specify the
width of a date and time informat that causes SAS to read a special character in the
last column.
Using Informats 527
Using Informats
INPUT Statement
The INPUT statement with an informat after a variable name is the simplest way to
read values into a variable. For example, the following INPUT statement uses two
informats:
input @15 style $3. @21 price 5.2;
The $w. character informat reads values into the variable STYLE. The w.d numeric
informat reads values into the variable PRICE.
For a complete discussion of the INPUT statement, see “INPUT Statement” in SAS
DATA Step Statements: Reference.
INPUT Function
The INPUT function converts a SAS character expression using a specified
informat. The informat determines whether the resulting value is numeric or
character. Thus, the INPUT function is useful for converting data. Here is an
example:
TempCharacter='98.6';
TemperatureNumber=input(TempCharacter,4.);
The INPUT function in combination with the w.d informat converts the character
value of TempCharacter to a numeric value and assigns the numeric value 98.6 to
TemperatureNumber.
528 Chapter 3 / About Informats
Use the PUT function with a SAS format to convert numeric values to character
values. For an example of a numeric-to-character conversion, see “PUT Function” in
SAS Functions and CALL Routines: Reference. For a complete discussion of the
INPUT function, see “INPUT Function” in SAS Functions and CALL Routines:
Reference.
INFORMAT Statement
The INFORMAT statement associates an informat with a variable. SAS uses the
informat in any subsequent INPUT statement to read values into the variable. For
example, in the following statements, the INFORMAT statement associates the
DATEw. informat with the variables Birthdate and Interview:
informat Birthdate Interview date9.;
input @63 Birthdate Interview;
Note: Anytime a text file originates from anywhere other than the local encoding
environment, it might be necessary to specify the ENCODING= option in either the
ASCII or EBCDIC environment. For example, when you read an EBCDIC text file on
an ASCII platform, it is recommended that you specify the ENCODING= option in
the FILENAME or INFILE statement. However, if you use the DSD and the DLM= or
DLMSTR= options in the FILENAME or INFILE statement, the ENCODING= option
is a requirement because these options require certain characters (such as
quotation marks, commas, and blanks) in the session encoding. The use of
Using Informats 529
encoding-specific informats should be reserved for use with true binary files (that is,
binary files that contain both character and non-character fields).
ATTRIB Statement
The ATTRIB statement can also associate an informat, as well as other attributes,
with one or more variables. For example, in the following statements, the ATTRIB
statement associates the DATEw. informat with the variables Birthdate and
Interview:
attrib Birthdate Interview informat=date9.;
input @63 Birthdate Interview;
User-Defined Informats
In addition to the informats that are supplied with Base SAS software, you can
create your own informats. In Base SAS software, PROC FORMAT enables you to
create your own informats and formats for both character and numeric variables. For
more information about user-defined informats, see “FORMAT Procedure” in Base
SAS Procedures Guide.
When you execute a SAS program that uses user-defined informats, these
informats should be available. Here are the two ways to make these informats
available:
n create permanent, not temporary, informats with PROC FORMAT
n store the source code that creates the informats (the PROC FORMAT step) with
the SAS program that uses them
530 Chapter 3 / About Informats
If you execute a program that cannot locate a user-defined informat, the result
depends on the setting of the FMTERR= system option. If the user-defined informat
is not found, the following system options produce these results:
Although using NOFMTERR enables SAS to process a variable, you lose the
information that the user-defined informat supplies. This option can cause a DATA
step to misread data, and it can produce incorrect results. For more information, see
“FMTERR System Option” in SAS System Options: Reference.
To avoid problems, make sure that users of your program have access to all the
user-defined informats that are used.
Definitions
Integer values for integer binary data are typically stored in one of three sizes: 1
byte, 2 bytes, or 4 bytes. The ordering of the bytes for the integer varies depending
on the platform (operating environment) on which the integers were produced.
The ordering of bytes differs between the “big endian” and the “little endian”
platforms. These colloquial terms are used to describe byte ordering for IBM
mainframes (big endian) and for platforms that are based on Intel (little endian). In
SAS, the following platforms are considered big endian: IBM mainframe, HP-UX,
AIX, Solaris on SPARC, and Macintosh. In SAS, the following platforms are
considered little endian: Intel ABI, Linux, OpenVMS Alpha, OpenVMS Integrity,
Solaris on x64, Tru64 UNIX, and Windows.
COBOL comp pic 9(4) comp pic 9(8) comp pic 9(16)
IBM assembler H F FD
Definitions
Packed decimal
specifies a method of encoding decimal numbers by using each byte to
represent two decimal digits. Packed decimal representation stores decimal data
with exact precision. The fractional part of the number is determined by the
informat or format because there is no separate mantissa and exponent.
An advantage of using packed decimal data is that exact precision can be
maintained. However, computations involving decimal data might become
inexact due to the lack of native instructions.
Zoned decimal
specifies a method of encoding decimal numbers in which each digit requires 1
byte of storage. The last byte contains the number's sign as well as the last digit.
Zoned decimal data produces a printable representation.
Nibble
specifies 1/2 of a byte.
Types of Data
n You can use the S370FPD format on all platforms to obtain the IBM mainframe
configuration.
n You can have unsigned packed data with no sign indicator. The packed decimal
format and informat handle the representation. It is consistent between ASCII
and EBCDIC platforms.
n Note that the S370FPDU format and informat expect to have an F in the last
nibble, whereas packed decimal data expects no sign nibble.
IBM mainframe has an Add Pack instruction to add packed decimal data, but the
platforms that are based on Intel have no such instruction and must convert the
decimal data to some other format.
Corresponding
S370Fxxx Formats and
IBM VS COBOL II Clauses Informats
For the packed decimal representation listed in the preceding table, X indicates the
number of digits represented, and W is the number of bytes. For PIC S9(X)
PACKED-DECIMAL, W is ceil((x+1)/2). For PIC 9(X) PACKED-DECIMAL, W is
ceil(x/2). For example, PIC S9(5) PACKED-DECIMAL represents five digits. If a
sign is included, six nibbles are needed. ceil((5+1)/2) has a length of 3 bytes,
and the value of W is 3.
Note that you can substitute COMP-3 for PACKED-DECIMAL.
In IBM assembly language, the P directive indicates packed decimal data, and the Z
directive indicates zoned decimal data. Here is an excerpt from an assembly
language list that shows the offset, the value, and the DC statement:
offset value (in hex) inst label directive
In PL/I, the FIXED DECIMAL attribute is used in conjunction with packed decimal
data. You must use the PICTURE specification to represent zoned decimal data.
There is no standardized representation of decimal data for the Fortran or C
languages.
536 Chapter 3 / About Informats
(positive) or x'D0'
(negative) in format.
Requirement Time values that are read by the extended notation informats that
begin with the characters E8601 must use an uppercase T.
W
indicates that the duration is specified in weeks.
Z
indicates that the time value is the time in Greenwich, England, or UTC, time.
+|-
the + indicates the time zone offset to the east of Greenwich, England. The -
indicates the time zone offset to the west of Greenwich, England.
yyyy
specifies a four-digit year.
mm
as part of a date, specifies a two-digit month, 01–12.
dd
specifies a two-digit day, 01–1.
hh
specifies a two-digit hour, 00–24.
mm
as part of a time, specifies a two-digit minute, 00–59.
ss
specifies a two-digit second, 00–59.
fff | ffffff
specifies an optional fraction of a second using the digits 0–9:
Reading Dates and Times by Using the ISO 8601 Basic and Extended Notations 539
fff uses 1–3 digits for values read by the $N8601B informat and the
$N8601E informat.
ffffff use 1–6 digits for informats other than the $N8601B and $N8601E
informats.
Y
indicates that a year value precedes this character in a duration.
M
as part of a date, indicates that a month value precedes this character in a
duration.
D
indicates that a day value precedes this character in a duration.
H
indicates that an hour value precedes this character in a duration.
M
as part of a time, indicates that a minute value precedes this character in a
duration.
S
indicates that a seconds value precedes this character in a duration.
Date, Time, or
Datetime ISO 8601 Notation Example Informat
Basic Notations
Date, Time, or
Datetime ISO 8601 Notation Example Informat
Extended Notations
When SAS reads an ISO 8601 value that specifies a time zone offset (+|–hh:mm or
+|–hhmm), the time or datetime value is adjusted to account for the offset. A SAS
time or datetime value for an ISO 8601 value with a time zone offset is the time or
datetime for the zero meridian (Greenwich, England). For example, if SAS reads the
datetime 2018-09-15T15:53:00+05:00 using the E8601DZ informat, the datetime
value 1852645980 has been adjusted for the five-hour time zone difference. This
datetime value is the datetime value for the zero meridian. If you write this value
using the E8601DZ format, the value is 2018–09–15T10:53:00+00:00. The hour
specified after the T shows the five-hour adjustment.
Reading Dates and Times by Using the ISO 8601 Basic and Extended Notations 541
For examples of reading ISO 8601 dates, times, and datetimes, see “Examples of
Reading and Writing Basic and Extended ISO 8601 Date, Time, and Datetime
Values” on page 51.
–PYYYYMMDDThhmmss –P20180915T155300
–PYYYY-MM- –P2018-09-15T15:53:00
DDThh:mm:ss
542 Chapter 3 / About Informats
–PnYnMnDTnHnMnS –P2n10m14dT20h13m45s
PnYnMnDTnHnMnS/ P2y10M14dT20h13m45s/
YYYYMMDDThhmmss 20180915T155300
YYYYMMDDThhmmss/ 20180915T155300/
PnYnMnDTnHnMnS P2y10M14dT20h13m45s
PnYnMnDTnHnMnS/ P2y10M14dT20h13m45s/
YYYY-MM-DDThh:mm:ss 2018-09-15T15:53:00
YYYY-MM-DDThh:mm:ss/ 2018-09-15T15:53:00/
PnYnMnDTnHnMnS P2y10M14dT20h13m45s
(all blank)
(all blank)
–p0003-02-02T-:31:33
The omitted component is the number of hours.
x-09-15T15:x:x
The omitted components are the number of years, minutes, and seconds.
2018-09-15T15:x:00/2016-09-15T15:x:00
The omitted components are the minutes.
When reading values that contain a time zone offset, omitted components are not
allowed. Use 00 in place of omitted components.
Truncated Values
SAS reads truncated duration, datetime, and interval values, where one or more
lower-order components is truncated because the value is 0 or the value is not
significant.
The following list shows examples of truncated values:
n p00030202T1031
n 2016-09-15T15/2018-09-15T15:53
n –p0003-03-03T-:-:-
n P2y3m4dT5h6m
n 2018-09-xTx:x:x
n 2018
When reading values that contain a time zone offset, truncation is not allowed. Use
00 in place of truncated values.
p3y13m p0004-01
pt24h24m65s P----01T-:25:05
p3y13mT24h61m P0004-01-01T01:01
p0004-13 p0005-01
p0003-02-61T15:61:61 P0003-04-01T16:02:01
p13m P13M
544 Chapter 3 / About Informats
If a component contains the largest value such as 60 for minutes or seconds, SAS
normalizes the value and replaces the value with a hyphen. For example,
pT12:60:13 becomes PT13:-:13.
Thirty days is used to normalize a month.
Dates and times in a datetime value that are greater than the standard value for the
component are not normalized. They produce an error.
n P2012-09-15T10.33
n 2012-09-15/P0003-03-03,333
545
4
Dictionary of Informats
Informats by Category
Here are the categories for informats:
Category Description
Category Description
Date Instructs SAS to write data values from variables that represent
dates.
See Date for a list of informats.
Date and Time instructs SAS to read date values into variables that represent
dates, times, and datetimes.
See Date and Time for a list of informats.
ISO 8601 instructs SAS to read date, time, and datetime values that are
written in the ISO 8601 standard into either numeric or
character variables.
See ISO 8601 for a list of informats.
Time Instructs SAS to write data values from variables that represent
times.
See Time for a list of informats.
CAS $ASCIIw. Informat (p. 560) Converts ASCII character data to native format.
$BASE64Xw. Informat (p. Converts ASCII text to character data by using Base 64
561) encoding.
$CBw. Informat (p. 564) Reads standard character data from column-binary files.
$N8601Bw.d Informat (p. Reads complete, truncated, and omitted forms of ISO 8601
571) duration, datetime, and interval values that are specified in
either the basic or extended notation.
$N8601Ew.d Informat (p. Reads ISO 8601 duration, datetime, and interval values that
573) are specified in the extended notation.
$PHEXw. Informat (p. 577) Converts packed hexadecimal data to character data.
$QUOTEw. Informat (p. Removes matching quotation marks from character data.
578)
ANYDTDTEw. Informat (p. Reads and extracts the date value from various date, time,
584) and datetime forms.
ANYDTDTMw. Informat (p. Reads and extracts datetime values from various date, time,
587) and datetime forms.
ANYDTTMEw. Informat (p. Reads and extracts time values from various date, time, and
590) datetime forms.
CBw.d Informat (p. 611) Reads standard numeric values from column-binary files.
COMMAXw.d Informat (p. Removes embedded periods, blanks, dollar signs, percent
613) signs, hyphens, and close parentheses from the input data.
An open parenthesis at the beginning of a field is converted
to a minus sign. The COMMAX informat reverses the roles
of the decimal point and the comma.
DATEw. Informat (p. 615) Reads date values in the form ddmmmyy or ddmmmyyyy.
550 Chapter 4 / Dictionary of Informats
DATETIMEw. Informat (p. Reads datetime values in the form ddmmmyy hh:mm:ss.ss
616) or ddmmmyyyy hh:mm:ss.ss.
DDMMYYw. Informat (p. Reads date values in the form ddmmyy<yy> or dd-mm-
619) yy<yy>, where a special character such as a hyphen (-),
period (.), or slash (/) separates the day, month, and year.
The year can be either two or four digits.
E8601DAw. Informat (p. Reads date values that are specified using the ISO 8601
620) extended notation yyyy-mm-dd.
E8601DNw. Informat (p. Reads date values that are specified using the ISO 8601
622) extended notation yyyy-mm-dd and returns SAS datetime
values where the time portion of the value is 000000.
E8601DTw.d Informat (p. Reads datetime values that are specified using the ISO
623) 8601 extended notation yyyy-mm-ddThh:mm:ss.<ffffff>.
E8601DZw.d Informat (p. Reads Coordinated Universal Time (UTC) datetime values
625) that are specified using the ISO 8601 datetime extended
notation yyyy-mm-ddThh:mm:ss+|–hh:mm.<fffff> or yyyy-
mm-ddThh:mm:ss.<fffff>Z.
E8601TMw.d Informat (p. Reads time values that are specified using the ISO 8601
630) extended notation hh:mm:ss.<ffffff>.
E8601TZw.d Informat (p. Reads time values that are specified using the ISO 8601
631) extended time notation hh:mm:ss+|–hh:mm.<ffffff> or
hh:mm:ssZ.
FLOATw.d Informat (p. 633) Reads a native single-precision, floating-point value and
divides it by 10 raised to the dth power.
HEXw. Informat (p. 635) Converts hexadecimal positive binary values to either
integer (fixed-point) or real (floating-point) binary values.
HHMMSSw. Informat (p. Reads hours, minutes, and seconds in the form hh:mm:ss or
636) hhmmss.
IBw.d Informat (p. 638) Reads native integer binary (fixed-point) values, including
negative values.
IBRw.d Informat (p. 640) Reads integer binary (fixed-point) values in Intel and DEC
formats.
IEEEw.d Informat (p. 642) Reads an IEEE floating-point value and divides it by 10
raised to the dth power.
JULIANw. Informat (p. 643) Reads Julian dates in the form yyddd or yyyyddd.
MMDDYYw. Informat (p. Reads date values in the form mmddyy or mmddyyyy.
647)
MONYYw. Informat (p. 649) Reads month and year date values in the form mmmyy or
mmmyyyy.
NUMXw.d Informat (p. 652) Reads numeric values with a comma in place of the decimal
point.
PDw.d Informat (p. 654) Reads data that is stored in IBM packed decimal format.
PDTIMEw. Informat (p. 659) Reads packed decimal time of SMF and RMF records.
PIBw.d Informat (p. 662) Reads positive integer binary (fixed-point) values.
PIBRw.d Informat (p. 664) Reads positive integer binary (fixed-point) values in Intel
and DEC formats.
PUNCH.d Informat (p. 667) Reads whether a row of column-binary data is punched.
RBw.d Informat (p. 668) Reads numeric data that is stored in real binary (floating-
point) notation.
RMFSTAMPw. Informat (p. Reads time and date fields of RMF records.
672)
S370FIBw.d Informat (p. Reads integer binary (fixed-point) values, including negative
677) values, in IBM mainframe format.
S370FIBUw.d Informat (p. Reads unsigned integer binary (fixed-point) values in IBM
678) mainframe format.
S370FPDUw.d Informat (p. Reads unsigned packed decimal data in IBM mainframe
682) format.
S370FPIBw.d Informat (p. Reads positive integer binary (fixed-point) values in IBM
683) mainframe format.
552 Chapter 4 / Dictionary of Informats
S370FRBw.d Informat (p. Reads real binary (floating-point) data in IBM mainframe
685) format.
S370FZDw.d Informat (p. Reads zoned decimal data in IBM mainframe format.
687)
S370FZDBw.d Informat (p. Reads zoned decimal data in which 0s have been left blank.
688)
S370FZDLw.d Informat (p. Reads zoned decimal leading-sign data in IBM mainframe
690) format.
S370FZDSw.d Informat (p. Reads zoned decimal, separate leading-sign data in IBM
691) mainframe format.
S370FZDTw.d Informat (p. Reads zoned decimal, separate trailing-sign data in IBM
692) mainframe format.
S370FZDUw.d Informat (p. Reads unsigned zoned decimal data in IBM mainframe
694) format.
SHRSTAMPw. Informat (p. Reads date and time values of SHR records.
695)
SMFSTAMPw. Informat (p. Reads time and date values of SMF records.
697)
TIMEw. Informat (p. 700) Reads hours, minutes, and seconds in the form
hh:mm:ss.ss, where special characters such as the colon (:)
or the period (.) are used to separate the hours, minutes,
and seconds.
VAXRBw.d Informat (p. Reads real binary (floating-point) data in VMS format.
705)
VMSZNw.d Informat (p. Reads VMS and MicroFocus COBOL zoned numeric data.
706)
YYMMDDw. Informat (p. Reads date values in the form yymmdd or yyyymmdd.
718)
YYMMNw. Informat (p. 720) Reads date values in the form yyyymm or yymm.
YYQw. Informat (p. 722) Reads quarters of the year in the form yyQq or yyyyQq.
Character $ASCIIw. Informat (p. 560) Converts ASCII character data to native format.
$BASE64Xw. Informat (p. Converts ASCII text to character data by using Base 64
561) encoding.
$PHEXw. Informat (p. 577) Converts packed hexadecimal data to character data.
$QUOTEw. Informat (p. Removes matching quotation marks from character data.
578)
Column Binary $CBw. Informat (p. 564) Reads standard character data from column-binary files.
CBw.d Informat (p. 611) Reads standard numeric values from column-binary files.
PUNCH.d Informat (p. 667) Reads whether a row of column-binary data is punched.
ROWw.d Informat (p. 673) Reads a column-binary field down a card column.
Date B8601DAw. Informat (p. Reads date values that are specified using the ISO 8601
594) base notation yyyymmdd.
B8601DNw. Informat (p. Reads date values that are specified using the ISO 8601
597) basic notation yyyymmdd and returns SAS datetime values
where the time portion of the value is 000000.
DATEw. Informat (p. 615) Reads date values in the form ddmmmyy or ddmmmyyyy.
DDMMYYw. Informat (p. Reads date values in the form ddmmyy<yy> or dd-mm-
619) yy<yy>, where a special character such as a hyphen (-),
period (.), or slash (/) separates the day, month, and year.
The year can be either two or four digits.
554 Chapter 4 / Dictionary of Informats
E8601DAw. Informat (p. Reads date values that are specified using the ISO 8601
620) extended notation yyyy-mm-dd.
E8601DNw. Informat (p. Reads date values that are specified using the ISO 8601
622) extended notation yyyy-mm-dd and returns SAS datetime
values where the time portion of the value is 000000.
MMDDYYw. Informat (p. Reads date values in the form mmddyy or mmddyyyy.
647)
MONYYw. Informat (p. 649) Reads month and year date values in the form mmmyy or
mmmyyyy.
PDJULGw. Informat (p. Reads packed Julian date values in the hexadecimal form
656) yyyydddF for IBM.
PDJULIw. Informat (p. 658) Reads packed Julian dates in the hexadecimal format
ccyydddF for IBM.
WEEKUw. Informat (p. 709) Reads a value in the form of a week number within the year
and returns a SAS date value by using the U algorithm.
WEEKVw. Informat (p. 711) Reads a value in the form of a week number within a year
and returns a SAS date value by using the V algorithm.
WEEKWw. Informat (p. Reads a value in the form of a week number within the year
714) and returns a SAS date value by using the W algorithm.
YYMMDDw. Informat (p. Reads date values in the form yymmdd or yyyymmdd.
718)
YYMMNw. Informat (p. 720) Reads date values in the form yyyymm or yymm.
YYQw. Informat (p. 722) Reads quarters of the year in the form yyQq or yyyyQq.
Date and Time $N8601Bw.d Informat (p. Reads complete, truncated, and omitted forms of ISO 8601
571) duration, datetime, and interval values that are specified in
either the basic or extended notation.
$N8601Ew.d Informat (p. Reads ISO 8601 duration, datetime, and interval values that
573) are specified in the extended notation.
ANYDTDTEw. Informat (p. Reads and extracts the date value from various date, time,
584) and datetime forms.
ANYDTDTMw. Informat (p. Reads and extracts datetime values from various date, time,
587) and datetime forms.
ANYDTTMEw. Informat (p. Reads and extracts time values from various date, time, and
590) datetime forms.
B8601CIw.d Informat (p. Reads an IBM date and time value that includes a century
592) marker, in the form cyymmddhhmmss<fff>.
Informats by Category 555
B8601DJw.d Informat (p. Reads a Java date and time value that is in the form
596) yyyymmddhhmmss<ffffff>.
B8601DNw. Informat (p. Reads date values that are specified using the ISO 8601
597) basic notation yyyymmdd and returns SAS datetime values
where the time portion of the value is 000000.
B8601DTw.d Informat (p. Reads datetime values that are specified using the ISO
599) 8601 basic notation yyyymmddThhmmss<ffffff>.
B8601DZw.d Informat (p. Reads Coordinated Universal Time (UTC) datetime values
601) that are specified using the ISO 8601 datetime basic
notation yyyymmddThhmmss+|–hhmm or
yyyymmddThhmmss<ffffff>Z.
DATETIMEw. Informat (p. Reads datetime values in the form ddmmmyy hh:mm:ss.ss
616) or ddmmmyyyy hh:mm:ss.ss.
E8601DTw.d Informat (p. Reads datetime values that are specified using the ISO
623) 8601 extended notation yyyy-mm-ddThh:mm:ss.<ffffff>.
E8601DZw.d Informat (p. Reads Coordinated Universal Time (UTC) datetime values
625) that are specified using the ISO 8601 datetime extended
notation yyyy-mm-ddThh:mm:ss+|–hh:mm.<fffff> or yyyy-
mm-ddThh:mm:ss.<fffff>Z.
JULIANw. Informat (p. 643) Reads Julian dates in the form yyddd or yyyyddd.
RMFSTAMPw. Informat (p. Reads time and date fields of RMF records.
672)
SHRSTAMPw. Informat (p. Reads date and time values of SHR records.
695)
SMFSTAMPw. Informat (p. Reads time and date values of SMF records.
697)
ISO 8601 $N8601Bw.d Informat (p. Reads complete, truncated, and omitted forms of ISO 8601
571) duration, datetime, and interval values that are specified in
either the basic or extended notation.
556 Chapter 4 / Dictionary of Informats
$N8601Ew.d Informat (p. Reads ISO 8601 duration, datetime, and interval values that
573) are specified in the extended notation.
B8601CIw.d Informat (p. Reads an IBM date and time value that includes a century
592) marker, in the form cyymmddhhmmss<fff>.
B8601DAw. Informat (p. Reads date values that are specified using the ISO 8601
594) base notation yyyymmdd.
B8601DJw.d Informat (p. Reads a Java date and time value that is in the form
596) yyyymmddhhmmss<ffffff>.
B8601DNw. Informat (p. Reads date values that are specified using the ISO 8601
597) basic notation yyyymmdd and returns SAS datetime values
where the time portion of the value is 000000.
B8601DTw.d Informat (p. Reads datetime values that are specified using the ISO
599) 8601 basic notation yyyymmddThhmmss<ffffff>.
B8601DZw.d Informat (p. Reads Coordinated Universal Time (UTC) datetime values
601) that are specified using the ISO 8601 datetime basic
notation yyyymmddThhmmss+|–hhmm or
yyyymmddThhmmss<ffffff>Z.
B8601TMw.d Informat (p. Reads time values that are specified using the ISO 8601
603) basic notation hhmmss<ffffff>.
B8601TZw.d Informat (p. Reads time values that are specified using the ISO 8601
605) basic time notation hhmmss<ffff>+|–hhmm or
hhmmss<ffffff>Z.
E8601DAw. Informat (p. Reads date values that are specified using the ISO 8601
620) extended notation yyyy-mm-dd.
E8601DNw. Informat (p. Reads date values that are specified using the ISO 8601
622) extended notation yyyy-mm-dd and returns SAS datetime
values where the time portion of the value is 000000.
E8601DTw.d Informat (p. Reads datetime values that are specified using the ISO
623) 8601 extended notation yyyy-mm-ddThh:mm:ss.<ffffff>.
E8601DZw.d Informat (p. Reads Coordinated Universal Time (UTC) datetime values
625) that are specified using the ISO 8601 datetime extended
notation yyyy-mm-ddThh:mm:ss+|–hh:mm.<fffff> or yyyy-
mm-ddThh:mm:ss.<fffff>Z.
E8601LZw.d Informat (p. Reads Coordinated Universal Time (UTC) values that are
628) specified using the ISO 8601 extended notation hh:mm:ss
+|–hh:mm.<fffff> or hh:mm:ss.<fffff>Z and converts the
values to the local time.
E8601TMw.d Informat (p. Reads time values that are specified using the ISO 8601
630) extended notation hh:mm:ss.<ffffff>.
Informats by Category 557
E8601TZw.d Informat (p. Reads time values that are specified using the ISO 8601
631) extended time notation hh:mm:ss+|–hh:mm.<ffffff> or
hh:mm:ssZ.
COMMAXw.d Informat (p. Removes embedded periods, blanks, dollar signs, percent
613) signs, hyphens, and close parentheses from the input data.
An open parenthesis at the beginning of a field is converted
to a minus sign. The COMMAX informat reverses the roles
of the decimal point and the comma.
FLOATw.d Informat (p. 633) Reads a native single-precision, floating-point value and
divides it by 10 raised to the dth power.
HEXw. Informat (p. 635) Converts hexadecimal positive binary values to either
integer (fixed-point) or real (floating-point) binary values.
IBw.d Informat (p. 638) Reads native integer binary (fixed-point) values, including
negative values.
IBRw.d Informat (p. 640) Reads integer binary (fixed-point) values in Intel and DEC
formats.
IEEEw.d Informat (p. 642) Reads an IEEE floating-point value and divides it by 10
raised to the dth power.
NUMXw.d Informat (p. 652) Reads numeric values with a comma in place of the decimal
point.
PDw.d Informat (p. 654) Reads data that is stored in IBM packed decimal format.
PIBw.d Informat (p. 662) Reads positive integer binary (fixed-point) values.
PIBRw.d Informat (p. 664) Reads positive integer binary (fixed-point) values in Intel
and DEC formats.
RBw.d Informat (p. 668) Reads numeric data that is stored in real binary (floating-
point) notation.
558 Chapter 4 / Dictionary of Informats
S370FIBw.d Informat (p. Reads integer binary (fixed-point) values, including negative
677) values, in IBM mainframe format.
S370FIBUw.d Informat (p. Reads unsigned integer binary (fixed-point) values in IBM
678) mainframe format.
S370FPDUw.d Informat (p. Reads unsigned packed decimal data in IBM mainframe
682) format.
S370FPIBw.d Informat (p. Reads positive integer binary (fixed-point) values in IBM
683) mainframe format.
S370FRBw.d Informat (p. Reads real binary (floating-point) data in IBM mainframe
685) format.
S370FZDw.d Informat (p. Reads zoned decimal data in IBM mainframe format.
687)
S370FZDBw.d Informat (p. Reads zoned decimal data in which 0s have been left blank.
688)
S370FZDLw.d Informat (p. Reads zoned decimal leading-sign data in IBM mainframe
690) format.
S370FZDSw.d Informat (p. Reads zoned decimal, separate leading-sign data in IBM
691) mainframe format.
S370FZDTw.d Informat (p. Reads zoned decimal, separate trailing-sign data in IBM
692) mainframe format.
S370FZDUw.d Informat (p. Reads unsigned zoned decimal data in IBM mainframe
694) format.
TRAILSGNw. Informat (p. Reads a trailing plus (+) or minus (–) sign.
703)
VAXRBw.d Informat (p. Reads real binary (floating-point) data in VMS format.
705)
VMSZNw.d Informat (p. Reads VMS and MicroFocus COBOL zoned numeric data.
706)
ZDBw.d Informat (p. 725) Reads zoned decimal data in which zeros have been left
blank.
Informats by Category 559
ZDVw.d Informat (p. 726) Reads and validates zoned decimal data.
Time B8601TMw.d Informat (p. Reads time values that are specified using the ISO 8601
603) basic notation hhmmss<ffffff>.
B8601TZw.d Informat (p. Reads time values that are specified using the ISO 8601
605) basic time notation hhmmss<ffff>+|–hhmm or
hhmmss<ffffff>Z.
E8601LZw.d Informat (p. Reads Coordinated Universal Time (UTC) values that are
628) specified using the ISO 8601 extended notation hh:mm:ss
+|–hh:mm.<fffff> or hh:mm:ss.<fffff>Z and converts the
values to the local time.
E8601TMw.d Informat (p. Reads time values that are specified using the ISO 8601
630) extended notation hh:mm:ss.<ffffff>.
E8601TZw.d Informat (p. Reads time values that are specified using the ISO 8601
631) extended time notation hh:mm:ss+|–hh:mm.<ffffff> or
hh:mm:ssZ.
HHMMSSw. Informat (p. Reads hours, minutes, and seconds in the form hh:mm:ss or
636) hhmmss.
PDTIMEw. Informat (p. 659) Reads packed decimal time of SMF and RMF records.
STIMERw. Informat (p. 698) Reads time values and determines whether the values are
hours, minutes, or seconds; reads the output of the STIMER
system option.
TIMEw. Informat (p. 700) Reads hours, minutes, and seconds in the form
hh:mm:ss.ss, where special characters such as the colon (:)
or the period (.) are used to separate the hours, minutes,
and seconds.
Dictionary
$ASCIIw. Informat
Converts ASCII character data to native format.
Categories: CAS
Character
Syntax
$ASCIIw.
Syntax Description
w
specifies the width of the input field.
Default 1 if the length of the variable is undefined. Otherwise, the default is the
length of the variable.
Range 1–32767
Details
If ASCII is the native format, no conversion occurs.
Comparisons
n On an IBM mainframe system, $ASCIIw. converts ASCII data to EBCDIC.
n On all other systems, $ASCIIw. behaves like the $CHARw. informat, except that
the default length is different.
$BASE64Xw. Informat 561
Example
data one;
input name $ascii3.;
put name $hex.;
datalines;
abc
ABC
;
run;
$BASE64Xw. Informat
Converts ASCII text to character data by using Base 64 encoding.
Categories: CAS
Character
Alignment: Left
Syntax
$BASE64Xw.
Syntax Description
w
specifies the width of the input field.
Default 1
Range 1–32767
562 Chapter 4 / Dictionary of Informats
Details
Base 64 is an industry encoding method whose encoded characters are determined
by using a positional scheme that uses only ASCII characters. Several Base 64
encoding schemes have been defined by the industry for specific uses, such as
email or content masking. SAS maps positions 0–61 to the characters A–Z, a–z,
and 0–9. Position 62 maps to the character +, and position 63 maps to the
character /.
Here are some uses of Base 64 encoding:
n embed binary data in an XML file
n encode passwords
n encode URLs
The '=' character in the encoded results indicates that the results have been padded
with zero bits. In order for the encoded characters to be decoded, the '=' must be
included in the value to be decoded.
Example
data _null_;
B64EXMPL="RkNBMDFBNzk5M0JD";
B64EXMPL2=input(B64EXMPL, $base64x64.);
put B64EXMPL / B64EXMPL2 ;
run;
Variable Result
B64EXMPL RkNBMDFBNzk5M0JD
B64EXMPL2 FCA01A7993BC
See Also
n The XMLDOUBLE option of the “LIBNAME Statement: XMLV2 and XML
Engines” in SAS XMLV2 and XML LIBNAME Engines: User’s Guide
Formats:
n “$BASE64Xw. Format” on page 104
$BINARYw. Informat
Converts binary data to character data.
$BINARYw. Informat 563
Categories: CAS
Character
Syntax
$BINARYw.
Syntax Description
w
specifies the width of the input field. Because eight bits of binary information
represent one character, every eight characters of input that $BINARYw. reads
become one character value stored in a variable.
If w< 8, $BINARYw. reads the data as w characters followed by 0s. Thus,
$BINARY4. reads the characters 0101 as 01010000, which converts to an
EBCDIC & or an ASCII P. If w> 8 but is not a multiple of 8, $BINARYw. reads up
to the largest multiple of 8 that is less than w before converting the data.
Default 8
Range 1–32767
Details
The $BINARYw. informat does not interpret actual binary data, but it converts a
string of characters that contains only 0s or 1s as if it is actual binary information.
Therefore, use only the character digits 1 and 0 in the input, with no embedded
blanks. $BINARYw. ignores leading and trailing blanks.
To read representations of binary codes for unprintable characters, enter an ASCII
or EBCDIC equivalent for a particular character as a string of 0s and 1s. The
$BINARYw. informat converts the string to its equivalent character value.
Comparisons
n The BINARYw. informat reads eight characters of input that contain only 0s or 1s
as a binary representation of 1 byte of numeric data.
n The $HEXw. informat reads hexadecimal characters that represent the ASCII or
EBCDIC equivalent of character data.
Example
data one;
564 Chapter 4 / Dictionary of Informats
name='0100110001001101';
name2=input(name,$binary16.);
put name ;
put name2 ;
run;
Variable Result
B64EXMPL RkNBMDFBNzk5M0JD
put name2; LM
$CBw. Informat
Reads standard character data from column-binary files.
Categories: CAS
Column Binary
Syntax
$CBw.
Syntax Description
w
specifies the width of the input field.
Default 1
Range 1–32767
Details
Column-binary data storage compresses data so that more than 80 items of data
can be stored on a single “virtual” punch card.
The $CBw. informat reads standard character data from column-binary files, where
each card column is represented in 2 bytes. The $CBw. informat translates the data
into standard character codes. If the combinations are invalid punch codes, SAS
returns blanks and sets the automatic variable _ERROR_ to 1.
$CHARw. Informat 565
Example
The variable is a hexadecimal representation of the column binary. The “virtual”
punch card column for the example data has row 12, row 6, and row 8 punched.
The binary representation is 0010 0000 0000 1010.
data _null_;
a=input('200a'x,$cb2.);
put a=;
run;
a + N
See Also
n “Description of Column-Binary Data Storage” in SAS Programmer’s Guide:
Essentials
Informats:
n “CBw.d Informat” on page 611
n “PUNCH.d Informat” on page 667
n “ROWw.d Informat” on page 673
$CHARw. Informat
Reads character data with blanks.
Categories: CAS
Character
Syntax
$CHARw.
Syntax Description
w
specifies the width of the input field.
566 Chapter 4 / Dictionary of Informats
Default 8 if the length of the variable is undefined. Otherwise, the default is the
length of the variable.
Range 1–32767
Details
The $CHARw. informat does not trim leading and trailing blanks or convert a single
period in the input data field to a blank before storing values. If you use $CHARw. in
an INFORMAT or ATTRIB statement within a DATA step to read list input, by default
SAS interprets any blank embedded within data as a field delimiter, including
leading blanks.
Comparisons
n The $CHARw. informat is almost identical to the $w. informat. However,
$CHARw. does not trim leading blanks or convert a single period in the input
data field to a blank, whereas the $w. informat does.
n Use the following table to compare the SAS informat $CHAR8. with notation in
other programming languages:
SAS $CHAR8.
C char [8]
Fortran A8
PL/I CHAR(8)
Example
This example uses the TRANSLATE function to replace specific characters in a
character expression. The TRANSLATE function converts the spaces in Name2 to #
symbols so that the blanks in the value are more obvious.
data one;
name=' X YZ';
name2=translate(input(name,$char5.),'#',' ');
$CHARZBw. Informat 567
put name ;
put name2 ;
run;
The character # represents a blank space.
SAS writes the following output to the log:
X YZ
#X#YZ
$CHARZBw. Informat
Converts binary 0s to blanks.
Categories: CAS
Character
Syntax
$CHARZBw.
Syntax Description
w
specifies the width of the input field.
Default 1 if the length of the variable is undefined. Otherwise, the default is the
length of the variable.
Range 1–32767
Details
The $CHARZBw. informat does not trim leading and trailing blanks in character data
before it stores values.
Comparisons
The $CHARZBw. informat is identical to the $CHARw. informat, except that
$CHARZBw. converts any byte that contains a binary 0 to a blank character.
568 Chapter 4 / Dictionary of Informats
Example
This hexadecimal input string, '58595A0000'x, is “XYZ” followed by two null
characters. The informat converts the null characters to spaces, indicated by
hexadecimal ‘20’x in the output.
data a;
x='58595A0000'x;
y=input(x,$charzb5.);
put y=;
put y=$hex10;
run;
SAS writes the following output to the log:
y=58595A2020
y=XYZ
$EBCDICw. Informat
Converts EBCDIC character data to native format.
Categories: CAS
Character
Syntax
$EBCDICw.
Syntax Description
w
specifies the width of the input field.
Default 1 if the length of the variable is undefined. Otherwise, the default is the
length of the variable.
Range 1–32767
Details
If EBCDIC is the native format, no conversion occurs.
Note: Anytime a text file originates from anywhere other than the local encoding
environment, it might be necessary to specify the ENCODING= option in either the
$HEXw. Informat 569
ASCII or EBCDIC environment. When you read an EBCDIC text file on an ASCII
platform, it is recommended that you specify the ENCODING= option in the
FILENAME or INFILE statement. However, if you use the DSD and the DLM= or
DLMSTR= option in the FILENAME or INFILE statement, the ENCODING= option is
required because these options require certain characters (for example, quotation
marks, commas, and blanks) in the session encoding. Encoding-specific informats
should be reserved for use with true binary files (that is, files that contain both
character and non-character fields).
Comparisons
n On an IBM mainframe system, $EBCDICw. behaves like the $CHARw. informat.
Example
data _null_;
a=input('qrs',$ebcdic3.);
b=input('QRS',$ebcdic3.);
c=input('+:>',$ebcdic3.);
put a= hex6. b= hex6. c= hex6.;
run;
Variable Result
a C9CACB
b E9EAEB
c 8B9A9E
Note: The results are hexadecimal representations of codes for characters. Each
two hexadecimal characters correspond to 1 byte of binary data, and each byte
corresponds to one character value.
$HEXw. Informat
Converts hexadecimal data to character data.
Categories: CAS
Character
570 Chapter 4 / Dictionary of Informats
Syntax
$HEXw.
Syntax Description
w
specifies the number of digits of hexadecimal data.
If w=1, $HEXw. pads a trailing hexadecimal 0. If w is an odd number that is
greater than 1, $HEXw. reads w–1 hexadecimal characters.
Default 2
Range 1–32767
Details
The $HEXw. informat converts every two digits of hexadecimal data to 1 byte of
character data. Use $HEXw. to encode hexadecimal values into a character variable
when your input method is limited to printable characters.
Comparisons
The HEXw. informat reads two digits of hexadecimal data at a time and converts
them to 1 byte of numeric data.
Example
data test;
name='6C6C';
name2=input(name,$hex4.);
run;
6C6C %% 11
$N8601Bw.d Informat 571
$N8601Bw.d Informat
Reads complete, truncated, and omitted forms of ISO 8601 duration, datetime, and interval values that are
specified in either the basic or extended notation.
Categories: CAS
Date and Time
ISO 8601
Alignment: Left
Restriction: UTC time zone offset values are not supported.
Supports: ISO 8601 Element 5.4.4, complete representation
Syntax
$N8601Bw.d
Syntax Description
w
specifies the width of the input field.
Default 50
Range 1–200
d
specifies the number of digits to the right of the decimal point in the seconds
value. This argument is optional.
Default 0
Range 0–6
Details
The $N8601B informat reads ISO 8601 duration, interval, and datetime values as
character data for these basic notations:
572 Chapter 4 / Dictionary of Informats
PyyyymmddThhmmss P00020304T050607
PnYnMnDTnHnMn.fffS P2y10m14dT20h13m45.2
22s
PnW P6w
yyyymmddThhmmss.fff/ 20120915T155300/201411
yyyymmddThhmmss.fff 15T120000
PnYnMnDTnHnMn.fffS/ P2y10M14dT20h13m45s/
yyyy-mm-ddThh:mm:ss.fff 2012-09-15T15:53:00
yyyy-mm- 2012-09-15T15:53:00/
ddThh:mm:ss.fff/ P2y10M14dT20h13m45s
PnYnMnDTnHnMn.fffS
yyyymmddThhmmss.fff 20120915T155300
The $N8601B informat also reads ISO 8601 duration, interval, and datetime
components that contain omitted or truncated components. Omitted components
must use a single hyphen ( - ) to represent the component.
Note: Using a month value that is greater than 12 with a datetime value causes an
error. For example, the value 20121415T000000/2014-09-15T00:00:00 causes an
error because the value for the month is 14.
Comparisons
The $N8601B informat reads durations, intervals, and datetimes that are specified in
either the basic or extended notation.
The $N8601E informat reads durations, intervals, and datetimes that are specified
only in the extended notation. Use the $N8601E informat when you need to ensure
compliance with the extended notation.
$N8601Ew.d Informat 573
Example
The resulting value of Date2 can be formatted so that it is displayed like Date with
the $N8601E format.
data one;
date='2018-09-15T15:53:00';
dt2=input(date,$n8601b20.);
put dt2 /
dt2=$N8601E.;
run;
SAS writes the following output to the log:
2018915155300FFD
dt2=2018-09-15T15:53:00
See Also
“Reading Dates and Times by Using the ISO 8601 Basic and Extended Notations”
on page 538
$N8601Ew.d Informat
Reads ISO 8601 duration, datetime, and interval values that are specified in the extended notation.
Categories: CAS
Date and Time
ISO 8601
Alignment: Left
Restriction: UTC time zone offset values are not supported.
Supports: ISO 8601 Element 5.4.4, complete representation
Syntax
$N8601Ew.d
Syntax Description
w
specifies the width of the input field.
Default 50
574 Chapter 4 / Dictionary of Informats
Range 1–200
d
specifies the number of digits to the right of the decimal point in the seconds
value. This argument is optional.
Default 0
Range 0–3
Details
The $N8601E informat reads ISO 8601 duration, interval, and datetime values that
can be specified in these extended notations:
PnW P6w
yyyy-mm- 2012-09-15T15:53:00/
ddThh:mm:ss.fff/ P2Y10M14DT20H13M45S
PnYnMnDTnHnMns.fffS
n
specifies a number that represents the number of years, months, or days.
P
is the character that is used to indicate that the duration that follows is specified
by the number of years, months, days, hours, minutes, and seconds.
W
is the character that is used to designate that the duration is specified in weeks.
T
is the character that is used to designate that a time value follows. If all time
values are 0, T is not required.
/
in an interval, is used to separate the beginning and ending datetime values.
yyyy
specifies a four-digit year.
$N8601Ew.d Informat 575
mm
specifies a two-digit month between 01 and 12.
dd
specifies a two-digit day between 01 and 31.
hh
specifies a two-digit hour between 00 and 23.
mm
specifies a two-digit minute between 00 and 59.
ss
specifies a two-digit second between 00 and 59.
fff
specifies an optional fraction of a second with a precision of up to three digits,
where each digit is between 0 and 9.
Y
is the character that is used to designate years in a duration.
M
is the character that is used to designate months in a duration.
D
is the character that is used to designate days in a duration.
H
is the character that is used to designate hours in a duration.
M
is the character that is used to designate minutes in a duration.
S
is the character that is used to designate seconds in a duration.
Comparisons
The $N8601E informat reads valid durations, intervals, and datetimes that are
specified only in the extended notation.
The $N8601B informat reads valid durations, intervals, and datetimes that are
specified in either the basic or extended notation.
Use the $N8601E informat when you need to ensure compliance with the extended
notation.
Example
The resulting value of Date2 can be formatted so that it is displayed like Date with
the $N8601E format.
data one;
date='2018-09-15T15:53:00';
date2=input(date,$n8601e20.);
put date2 /
576 Chapter 4 / Dictionary of Informats
date2=$N8601E.;
run;
SAS writes the following output to the log:
2012915155300FFD
date2=2018-09-15T15:53:00
See Also
“Reading Dates and Times by Using the ISO 8601 Basic and Extended Notations”
on page 538
$OCTALw. Informat
Converts octal data to character data.
Categories: CAS
Character
Syntax
$OCTALw.
Syntax Description
w
specifies the width of the input field in bits. Because one digit of octal data
represents three bits of binary information, increment the value of w by three for
every column of octal data that $OCTALw. reads.
Default 3
Range 1–32767
Details
Eight bits of binary data represent the code for one digit of character data.
Therefore, you need at least three digits of octal data to represent one digit of
character data, which includes an extra bit. $OCTALw. treats every three digits of
octal data as one digit of character data, ignoring the extra bit.
Use $OCTALw. to read octal representations of binary codes for unprintable
characters. Enter an ASCII or EBCDIC equivalent for a particular character in octal
$PHEXw. Informat 577
notation. Then use $OCTALw. to convert the octal notation to its equivalent
character value.
Use only the digits 0 through 7 in the input, with no embedded blanks. $OCTALw.
ignores leading and trailing blanks.
Comparisons
The OCTALw. informat reads octal data and converts it to the numeric equivalents.
Example
data _null_;
a=input('141162164040040', $octal15.);
b=input('162151143145040', $octal15.);
c=input('142141156153040', $octal15.);
put a= b= c=;
run;
SAS writes the following output to the log:
$PHEXw. Informat
Converts packed hexadecimal data to character data.
Categories: CAS
Character
Syntax
$PHEXw.
Syntax Description
w
specifies the number of bytes in the input.
When you use $PHEXw. to read packed hexadecimal data, the length of the
variable is the number of bytes that are required to store the resulting character
value, not w. In general, a character variable whose length is implicitly defined
with $PHEXw. has a length of 2w–1.
578 Chapter 4 / Dictionary of Informats
Default 2
Range 1–32767
Details
Packed hexadecimal data is like packed decimal data, except that all hexadecimal
characters are valid. In packed hexadecimal data, the value of the low-order nibble
has no meaning. In packed decimal data, the value of the low-order nibble indicates
the sign of the numeric value that the data represents. The $PHEXw. informat
returns a character value and treats the value of the sign nibble as if it were X'F',
regardless of its actual value.
Comparisons
The PDw.d. informat reads packed decimal data and converts it to numeric data.
Example
data _null_;
a=input('0001111000001111',$phex.);
put a=;
run;
SAS writes the following to the log:
a=303
$QUOTEw. Informat
Removes matching quotation marks from character data.
Categories: CAS
Character
Syntax
$QUOTEw.
$UPCASEw. Informat 579
Syntax Description
w
specifies the width of the input field.
Default 8 if the length of the variable is undefined. Otherwise, the default is the
length of the variable.
Range 1–32767
Example
data one;
name='SAS';
name2=input(name,$quote7.);
put name2= ;
run;
SAS writes the following output to the log:
name2=SAS
$UPCASEw. Informat
Converts character data to uppercase.
Categories: CAS
Character
Syntax
$UPCASEw.
Syntax Description
w
specifies the width of the input field.
Default 8 if the length of the variable is undefined. Otherwise, the default is the
length of the variable.
Range 1–32767
580 Chapter 4 / Dictionary of Informats
Details
Special characters, such as hyphens, are not altered.
Example
data test;
name='sas';
name2=input(name,$upcase.);
put name2 ;
run;
Variable Result
----+----1
sas SAS
$UUIDw. Informat
Converts a Universally Unique Identifier (UUID) to binary data.
Syntax
$UUIDw.
Arguments
w
specifies the width of the input field.
Range 1–36
Details
The input for the informat should be a character representation of a UUID. That
representation consists of eight hexadecimal characters, a hyphen, four
hexadecimal digits, a hyphen, four hexadecimal characters, a hyphen, and twelve
hexadecimal characters. A total of thirty-two hexadecimal characters convert to 16
binary bytes. The input typically uses lowercase for the hexadecimal characters a–f,
$VARYINGw. Informat 581
Example
data _null_;
length x $16;
x = input('1548611f-b8cb-6a47-a721-a6fd284e74f2',$uuid36.);
put x $hex.;
run;
SAS writes the following output to the log:
1548611FB8CB6A47A721A6FD284E74F2
$VARYINGw. Informat
Reads character data of varying length.
Categories: CAS
Character
Syntax
$VARYINGw. length-variable
Syntax Description
w
specifies the maximum width of a character field for all the records in an input
file.
Default 8 if the length of the variable is undefined. Otherwise, the default is the
length of the variable.
Range 1–32767
length-variable
specifies a numeric variable that contains the width of the character field in the
current record. SAS obtains the value of length-variable by reading it directly
from a field that is described in an INPUT statement or by calculating its value in
the DATA step.
Details
Use $VARYINGw. when the length of a character value differs from record to record.
After reading a data value with $VARYINGw., the pointer's position is set to the first
column after the value.
Examples
shark
sun
bluefish
$w. Informat 583
Variable Result
----+----1----+----2
$w. Informat
Reads standard character data.
Categories: CAS
Character
Alias: $Fw.
Syntax
$w.
584 Chapter 4 / Dictionary of Informats
Syntax Description
w
specifies the width of the input field. You must specify w because SAS does not
supply a default value.
Range 1–32767
Details
The $w. informat trims leading blanks and left-aligns the values before storing the
text. In addition, if a field contains only blanks and a single period, $w. converts the
period to a blank because it interprets the period as a missing value. The $w.
informat treats two or more periods in a field as character data.
Comparisons
The $w. informat is almost identical to the $CHARw. informat. However, $CHARw.
does not trim leading blanks nor does it convert a single period in an input field to a
blank, whereas $w. does both.
Example
This example truncates the leading blanks on the name statement.
data one;
name=' XYZ';
name2=input(name,$5.);
put name2;
run;
SAS writes the following output to the log:
XYZ
ANYDTDTEw. Informat
Reads and extracts the date value from various date, time, and datetime forms.
Categories: CAS
Date and Time
Restriction: Do not use a period (.) as a separator in the date part or between the date and time
parts of date-time values. SAS might consider a period to be an invalid separator in the
date part of ANYDTDTE values when running in certain environments. The time part of
ANYDTDTEw. Informat 585
the date-time value can contain a period. For example, 01JAN2018 14:30:08.5 is a valid
date-time value that contains a period in the time part.
Syntax
ANYDTDTEw.
Syntax Description
w
specifies the width of the input field.
Default 9
Range 5–60
Details
The ANYDTDTE informat reads input data that corresponds to any of the following
informats or date, time, or datetime forms. Then, the informat extracts the date part
from the derived value.
01-2018
Comparisons
The ANYDTDTE informat extracts the date part from the derived value. The
ANYDTDTM informat extracts the datetime part. The ANYDTTME informat extracts
the time part.
Example
data test;
dateinfo='01JAN2018 14:30:08.5';
sasdate=input(dateinfo,anydtdte21.);
put sasdate ;
put sasdate date9.;
run;
SAS writes the following output to the log.
21185
01JAN2018
See Also
Informats:
n “ANYDTDTMw. Informat” on page 587
n “ANYDTTMEw. Informat” on page 590
n “DATEw. Informat” on page 615
n “DATETIMEw. Informat” on page 616
n “DDMMYYw. Informat” on page 619
n “JULIANw. Informat” on page 643
ANYDTDTMw. Informat 587
ANYDTDTMw. Informat
Reads and extracts datetime values from various date, time, and datetime forms.
Categories: CAS
Date and Time
Restriction: Do not use a period (.) as a separator in the date part or between the date and time
parts of date-time values. SAS might consider a period to be an invalid separator in the
date part of ANYDTDTM values when running in certain environments. The time part of
the date-time value can contain a period. For example, 01JAN2018 14:30:08.5 is a valid
date-time value that contains a period in the time part.
Interaction: If an input datetime value contains a special character for formatting characters and the
character is not B, C, N, P, or S, the ANYDTDTMw. informat reads only the date portion
of the input and the time is set to 0. For example, for an EN_US locale, an input value of
'150501X1' results in 01MAY15:00:00:00.
Syntax
ANYDTDTMw.
Syntax Description
w
specifies the width of the input field.
Default 19
Range 1–60
Details
The ANYDTDTM informat reads data that is in the form of any of the following
informats or datetime forms. Then, the format extracts the datetime part from the
derived value:
588 Chapter 4 / Dictionary of Informats
DATE 01JAN18
01JAN2018
DDMM<YY>YY 2, 3 010118
01012018
JULIAN 18001
2018001
MMDD<YY>YY 2, 3 010118
01012018
MMx<YY>YY 1, 2 01/18
01-2018
MONYY JAN18
JAN2018
TIME 14.30
14:30:08.05
<YY>YYMMDD 2 180101
20180101
<YY>YYQ 2 18Q1
2018Q1
<YY>YYxMM 1, 2 18/01
2018/01
If the input value is a time-only value, SAS assumes a date of 01JAN1960. If the
input value is a date-only value, SAS assumes a time of 12:00 midnight. Input time
values must include hours and minutes. If any part of a date in the input value is
missing in the input value, or if the hour and minutes in a time value are missing or
out of range, the value read is a SAS missing value.
The input values for the preceding informats are mutually exclusive except for
MMDDYY, DDMMYY, or YYMMDD when two-digit years are used. It is possible for
input data such as 01-02-03 or 01-02 to be ambiguous with respect to the month,
day, and year. In this case, the DATESTYLE system option indicates the order of the
month, day, and year.
The ANYDTTME informat uses these rules when reading colons and periods in time
values:
Comparisons
The ANYDTDTE informat extracts the date part from the derived value. The
ANYDTDTM informat extracts the datetime part. The ANYDTTME informat extracts
the time part.
Example
data test;
dateinfo='01JAN2018 14:30:08.5';
sasdt=input(dateinfo,anydtdtm21.);
put sasdt ;
put sasdt datetime20.;
run;
SAS writes the following output to the log:
1830436208.5
01JAN2018:14:30:09
590 Chapter 4 / Dictionary of Informats
See Also
Informats:
n “ANYDTDTEw. Informat” on page 584
n “ANYDTTMEw. Informat” on page 590
n “DATEw. Informat” on page 615
n “DATETIMEw. Informat” on page 616
n “DDMMYYw. Informat” on page 619
n “JULIANw. Informat” on page 643
n “MMDDYYw. Informat” on page 647
n “MONYYw. Informat” on page 649
n “TIMEw. Informat” on page 700
n “YYMMDDw. Informat” on page 718
n “YYQw. Informat” on page 722
ANYDTTMEw. Informat
Reads and extracts time values from various date, time, and datetime forms.
Categories: CAS
Date and Time
Restriction: Do not use a period (.) as a separator in the date part or between the date and time
parts of date-time values. SAS might consider a period to be an invalid separator in the
date part of ANYDTTME values when running in certain environments. The time part of
the date-time value can contain a period. For example, 01JAN2018 14:30:08.5 is a valid
date-time value that contains a period in the time part.
Syntax
ANYDTTMEw.
Syntax Description
w
specifies the width of the input field.
Default 8
Range 1–60
ANYDTTMEw. Informat 591
Details
The ANYDTTME informat reads input data that corresponds to any of these
informats or forms:
If the input value is a time-only value, SAS assumes a date of 01JAN1960. If the
input value is a date value only, SAS assumes a time of 12:00 midnight.
It is possible for input data such as 01-02-03 or 01-02 to be ambiguous with respect
to the month, day, and year. In this case, the DATESTYLE system option indicates
the order of the month, day, and year.
The ANYDTTME informat uses these rules when reading colons and periods in time
values:
Comparisons
The ANYDTDTE informat extracts the date part from the derived value. The
ANYDTDTM informat extracts the datetime part. The ANYDTTME informat extracts
the time part.
Example
data test;
dateinfo='01JAN2018 14:30:08.5';
sastime=input(dateinfo,anydttme21.);
put sastime ;
put sastime time8.2;
run;
Variable Result
See Also
Informats:
n “ANYDTDTEw. Informat” on page 584
n “ANYDTDTMw. Informat” on page 587
n “DATEw. Informat” on page 615
n “DATETIMEw. Informat” on page 616
n “DDMMYYw. Informat” on page 619
n “JULIANw. Informat” on page 643
n “MMDDYYw. Informat” on page 647
n “MONYYw. Informat” on page 649
n “TIMEw. Informat” on page 700
n “YYMMDDw. Informat” on page 718
n “YYQw. Informat” on page 722
B8601CIw.d Informat
Reads an IBM date and time value that includes a century marker, in the form cyymmddhhmmss<fff>.
B8601CIw.d Informat 593
Syntax
B8601CIw.d
Syntax Description
w
specifies the width of the input field.
Default 16
Range 10–26
d
specifies the number of digits to the right of the decimal point in the seconds
value.
Default 0
Range 0–6
Details
The B8601CI informat reads time values that are specified in the IBM time notation
cyymmddhhmmss<fff>.
c
is a single digit that represents a century.
Digit Century
Digit Century
determine the century marker for the year 2382, perform this calculation:
(2382–1900)/100=4.82. Discard .82. The century marker is 4.
yy
is a two-digit year between 00 and 99.
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
fff
are optional fractional seconds, with a precision of up to three digits, where each
digit is between 0 and 9.
Example
data one;
date='118100112153025';
date2=input(date,B8601CI.);
put date2 /
date2 datetime25.2;
run;
SAS writes the following output to the log:
1854015330.3
01OCT2018:12:15:30.25
B8601DAw. Informat
Reads date values that are specified using the ISO 8601 base notation yyyymmdd.
Categories: Date
ISO 8601
Alignment: Left
Alias: ND8601DAw
Restrictions: This informat is not supported in a DATA step that runs in CAS.
B8601DAw. Informat 595
Syntax
B8601DAw.
Syntax Description
w
specifies the width of the input field.
Default 10
Details
The B8601DA informat reads date values that are specified using the ISO 8601
basic date notation yyyymmdd.
yyyy
is a four-digit year.
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
If the month or day values are omitted, SAS uses a value of 1 for the month or day.
Example
data _null_;
input d b8601da.;
put d;
datalines;
20180915
2018
;
run;
SAS writes the following to the log.
21442
21185
596 Chapter 4 / Dictionary of Informats
See Also
“Reading Dates and Times by Using the ISO 8601 Basic and Extended Notations”
on page 538
B8601DJw.d Informat
Reads a Java date and time value that is in the form yyyymmddhhmmss<ffffff>.
Categories: Date and Time
ISO 8601
Alignment: Left
Restriction: This informat is not supported in a DATA step that runs in CAS.
Syntax
B8601DJw.d
Syntax Description
w
specifies the width of the input field.
Default 16
Range 10–26
d
specifies the number of digits to the right of the decimal point in the seconds
value.
Default 0
Range 0–6
Details
The B8601DJw.d informat reads a date and time value that is specified using the
Java date and time notation yyyymmddhhmmss<ffffff>.
yyyy
is a four-digit year between 0000 and 9999.
mm
is a two-digit month (zero padded) between 01 and 12.
B8601DNw. Informat 597
dd
is a two-digit day of the month (zero padded) between 01 and 31.
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
ffffff
are optional fractional seconds, with a precision of up to six digits, where each
digit is between 0 and 9.
Comparisons
The B8601DJw.d informat reads a date and time value that does not include a T to
separate the date from the time.
Java date and time values do not include a T. For example, the date September 1,
2018 at 7:30:00.33 a.m. is written as 2018090107300033.
ISO 8601 date and time values include a T. For example, the date September 1,
2018 at 7:30:00.33 a.m. is written as 20180901T07300033.
Example
data one;
date='2018090107300033';
date2=input(date,B8601DJ.);
put datetm2 /
datetm2 datetime25.2;
run;
SAS writes the following output to the log:
1851406200.3
01SEP2018:07:30:00.33
B8601DNw. Informat
Reads date values that are specified using the ISO 8601 basic notation yyyymmdd and returns SAS
datetime values where the time portion of the value is 000000.
Categories: Date
Date and Time
ISO 8601
Alignment: Left
598 Chapter 4 / Dictionary of Informats
Alias: ND8601DNw
Restrictions: This informat is not supported in a DATA step that runs in CAS.
UTC time zone offset values are not supported.
Supports: ISO 8601 Element 5.2.1.1, complete representation
Syntax
B8601DNw.
Syntax Description
w
specifies the width of the input field.
Default 10
Details
The B8601DN informat reads date values that are specified using the ISO 8601
basic date notation yyyymmdd and returns the date in a SAS datetime value.
yyyy
is a four-digit year.
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
Example
data one;
date='20180915';
datetm=input(date,B8601DN.);
put datetm /
datetm datetime20.;
run;
SAS writes the following output to the log:
1852588800
15SEP2018:00:00:00
B8601DTw.d Informat 599
See Also
“Reading Dates and Times by Using the ISO 8601 Basic and Extended Notations”
on page 538
B8601DTw.d Informat
Reads datetime values that are specified using the ISO 8601 basic notation yyyymmddThhmmss<ffffff>.
Categories: Date and Time
ISO 8601
Alignment: Left
Aliases: B8601LXw.d
ND8601DTw.d
Restrictions: This informat is not supported in a DATA step that runs in CAS.
UTC time zone offset values are not supported.
Syntax
B8601DTw.d
Syntax Description
w
specifies the width of the input field.
Default 19
Range 14–26
d
specifies the number of digits to the right of the decimal point in the seconds
value. This argument is optional.
Default 0
Range 0–6
Details
The B8601DT informat reads datetime values that are specified in the ISO 8601
basic datetime notation yyyymmddThhmmss<ffffff>.
yyyy
is a four-digit year.
600 Chapter 4 / Dictionary of Informats
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
ffffff
are optional fractional seconds, with a precision of up to six digits, where each
digit is between 0 and 9.
If the month or day values are omitted, SAS uses a value of 1 for the month or day.
If the hour, minute, or second values are omitted, SAS uses a value of 0 for the
hour, minute, or second.
Example
data _null_;
input d b8601dt.;
put d;
datalines;
20180915T155300
2018
;
run;
SAS writes the following to the log.
1852645980
1830384000
See Also
“Reading Dates and Times by Using the ISO 8601 Basic and Extended Notations”
on page 538
B8601DXw. Informat
Adjusts a Coordinated Universal Time (UTC) datetime value to the user’s local date and time. Then, reads
the local date and time by using the ISO 8601 datetime and time zone basic notation yyyymmddThhmmss
+|-hhmm
Restriction: This informat is not supported in a DATA step that runs in CAS.
B8601DZw.d Informat 601
See: The B8601DXw. informat uses the B8601DZw.d informat to read data. See
“B8601DZw.d Informat” on page 601.
Syntax
B8601DXw.
B8601DZw.d Informat
Reads Coordinated Universal Time (UTC) datetime values that are specified using the ISO 8601 datetime
basic notation yyyymmddThhmmss+|–hhmm or yyyymmddThhmmss<ffffff>Z.
Categories: Date and Time
ISO 8601
Alignment: Left
Aliases: B8601DXw.d
ND8601DZw.d
Restrictions: This informat is not supported in a DATA step that runs in CAS.
UTC time zone offset values are not supported.
Supports: ISO 8601 Element 5.4.1, complete representation
Syntax
B8601DZw.d
Syntax Description
w
specifies the width of the input field.
Default 26
Range 15–35
d
specifies the number of digits to the right of the seconds value, which represents
a fraction of a second. This argument is optional.
Default 0
Range 0–6
602 Chapter 4 / Dictionary of Informats
Details
UTC values specify a time and a time zone based on the zero meridian in
Greenwich, England. The B8601DZ informat reads datetime values that are
specified in one of these ISO 8601 basic datetime notations:
n yyyymmddThhmmss+|–hhmm
n yyyymmddThhmmss<ffffff>Z
yyyy
is a four-digit year.
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
hh
is a two-digit hour (zero padded) between 00 and 24.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
ffffff
are optional fractional seconds, with a precision of up to six digits, where each
digit is between 0 and 9.
+|–hhmm
is an hour and minute signed offset from zero meridian time. Note that the offset
must be +|–hhmm (that is, + or – and four characters).
Use + for time zones east of the zero meridian, and use – for time zones west of
the zero meridian. For example, +0200 indicates a two-hour time difference to
the east of the zero meridian, and –0600 indicates a six–hour time difference to
the west of the zero meridian.
Restriction: The shorter form +|–hh is not supported.
Z
indicates that the time is for zero meridian (Greenwich, England) or +0000 UTC.
Example
data one;
input d b8601dz.;
put d;
put d datetime.;
datalines;
20180915T155300+0500
;
run;
SAS writes the following output to the log:
B8601TMw.d Informat 603
1852627980
15SEP18:10:53:00
See Also
“Reading Dates and Times by Using the ISO 8601 Basic and Extended Notations”
on page 538
B8601LXw. Informat
Reads datetime values as local time by appending a time zone offset difference between the local time and
UTC, using the ISO 8601 basic notation yyyymmddThhmmss+|–hhmm.
Restriction: This informat is not supported in a DATA step that runs in CAS.
See: The B8601LXw.d informat uses the B8601DTw.d informat to read data. See
“B8601DTw.d Informat” on page 599.
Syntax
B8601LXw.d
B8601TMw.d Informat
Reads time values that are specified using the ISO 8601 basic notation hhmmss<ffffff>.
Categories: Time
ISO 8601
Alignment: Left
Alias: ND8601TMw.d
Restrictions: This informat is not supported in a DATA step that runs in CAS.
UTC time zone offset values are not supported.
Supports: ISO 8601 Elements 5.3.1.1 and 5.3.1.3, complete representation and representation of
decimal fractions
Syntax
B8601TMw.d
604 Chapter 4 / Dictionary of Informats
Syntax Description
w
specifies the width of the input field.
Default 8
Range 6–15
d
specifies the number of digits to the right of the decimal point in the seconds
value. This argument is optional.
Default 0
Range 0–6
Details
The B8601TM informat reads time values that are specified using the ISO 8601
basic time notation hhmmss<ffffff>:
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
ffffff
are optional fractional seconds, with a precision of up to six digits, where each
digit is between 0 and 9.
Example
data one;
input d b8601tm.;
put d;
datalines;
155300
run;
SAS writes the following output to the log:
57180
B8601TZw.d Informat 605
See Also
“Reading Dates and Times by Using the ISO 8601 Basic and Extended Notations”
on page 538
B8601TXw. Informat
Adjusts a Coordinated Universal Time (UTC) value to the user’s local time. Then, reads the local time by
using the ISO 8601 basic time notation hhmmss+|–hhmm.
Restriction: This informat is not supported in a DATA step that runs in CAS.
See: The B8601TXw. informat uses the B8601TZw.d informat to read data. See “B8601TZw.d
Informat” on page 605.
Syntax
B8601TXw.
B8601TZw.d Informat
Reads time values that are specified using the ISO 8601 basic time notation hhmmss<ffff>+|–hhmm or
hhmmss<ffffff>Z.
Categories: Time
ISO 8601
Alignment: Left
Aliases: B8601TXw.d
ND8601TZw.d
Restrictions: This informat is not supported in a DATA step that runs in CAS.
UTC time zone offset values are not supported.
Supports: ISO 8601 Element 5.3.1.1, complete representation
Syntax
B8601TZw.d
Syntax Description
w
specifies the width of the input field.
606 Chapter 4 / Dictionary of Informats
Default 14
Range 7–20
d
(optional) specifies the number of digits to the right of the decimal point in the
seconds value.
Default 0
Range 0–6
Details
UTC time values specify a time and a time zone based on the zero meridian in
Greenwich, England. The B8601TZ informat reads time values that are specified in
these ISO 8601 basic time notations:
n hhmmss<ffffff>+|–hhmm
n hhmmss<ffffff>Z
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
ffffff
are optional fractional seconds, with a precision of up to six digits, where each
digit is between 0 and 9.
+|–hh:mm
is an hour and minute signed offset from zero meridian time. Note that the offset
must be +|–hhmm (that is, + or – and four characters).
Use + for time zones east of the zero meridian, and use – for time zones west of
the zero meridian. For example, +0200 indicates a two-hour time difference to
the east of the zero meridian, and –0600 indicates a six-hour time difference to
the west of the zero meridian.
Restriction: The shorter form +|–hh is not supported.
Z
indicates that the time is for zero meridian (Greenwich, England) or +0000 UTC
time.
When SAS reads a UTC time by using the B8601TZ informat and the adjusted time
is greater than 240000 or less than 000000, SAS adjusts the time value so that the
time is between 000000 and 240000. For example, if SAS reads the UTC time
234344–0500 using the B8601TZ informat, SAS adds five hours to the time so that
the value is 284344, and then makes the time adjustment. The value stored
represents the time 044344+0000.
BINARYw.d Informat 607
Example
data _null_;
input d b8601tz.;
put d= d=time8.;;
datalines;
202401-0500
202401Z
202401+0000
run;
SAS writes the following output to the log:
d=5041 d=1:24:01
d=73441 d=20:24:01
d=73441 d=20:24:01
See Also
“Reading Dates and Times by Using the ISO 8601 Basic and Extended Notations”
on page 538
BINARYw.d Informat
Converts positive binary values to integers.
Categories: CAS
Numeric
Syntax
BINARYw.d
Syntax Description
w
specifies the width of the input field.
Default 8
Range 1–64
d
specifies the power of 10 by which to divide the value. SAS uses the d value
even if the data contains decimal points. This argument is optional.
Range 0–31
608 Chapter 4 / Dictionary of Informats
Details
Use only the character digits 1 and 0 in the input, with no embedded blanks.
BINARYw.d ignores leading and trailing blanks.
BINARYw.d cannot read negative values. It treats all input values as positive
(unsigned).
Example
data one;
input @1 value binary8.1;
put value;
datalines;
00001111
run;
SAS writes the following output to the log:
1.5
BITSw.d Informat
Extracts bits.
Category: Numeric
Restriction: This informat is not supported in a DATA step that runs in CAS.
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
Syntax
BITSw.d
Syntax Description
w
specifies the number of bits to read.
Default 1
Range 1–64
BZw.d Informat 609
d
specifies the zero-based offset.
Range 0–63
Details
The BITSw.d informat extracts particular bits from an input stream and assigns the
numeric equivalent of the extracted bit string to a variable. Together, the w and d
values specify the location of the string that you want to read.
This informat is useful for extracting data from system records with many pieces of
information packed into single bytes.
Example
The EBCDIC binary code for a capital B is 11000010, and the ASCII binary code is
01000010. The INPUT statement reads four bits (w=4), which is the bit string 1000,
and stores the numeric value 8, which is equivalent to this binary combination.
data _null_;
a=input('B',bits4.1);
put a=;
run;
SAS writes the following output to the log:
a=8
BZw.d Informat
Converts blanks to 0s.
Category: Numeric
Restriction: This informat is not supported in a DATA step that runs in CAS.
Syntax
BZw.d
Syntax Description
w
specifies the width of the input field.
610 Chapter 4 / Dictionary of Informats
Default 1
Range 1–32
d
specifies the power of 10 by which to divide the value. If the data contains
decimal points, the d value is ignored. This argument is optional.
Range 0–31
Details
The BZw.d informat reads numeric values, converts any trailing or embedded blanks
to 0s, and ignores leading blanks.
The BZw.d informat can read numeric values that are located anywhere in the field.
Blanks can precede or follow the numeric value, and a minus sign must precede
negative values. The BZw.d informat ignores blanks between a minus sign and a
numeric value in an input field.
The BZw.d informat interprets a single period in a field as a 0. The informat
interprets multiple periods or other nonnumeric characters in a field as a missing
value.
To use BZw.d in a DATA step with list input, change the delimiter for list input with
the DLM= or DLMSTR= option in the INFILE statement. By default, SAS interprets
blanks between values in the variable as delimiters rather than 0s.
Comparisons
The BZw.d informat converts trailing or embedded blanks to 0s. If you do not want
to convert trailing blanks to 0s (for example, when reading values in E notation), use
either the w.d informat or the Ew.d informat instead.
Example
data _null_;
input @1 x bz4.;
put x;
datalines;
34
-2
-2 1
.
run;
SAS writes the following output to the log:
CBw.d Informat 611
3400
-200
-201
0
CBw.d Informat
Reads standard numeric values from column-binary files.
Categories: CAS
Column Binary
Syntax
CBw.d
Syntax Description
w
specifies the width of the input field.
Default 1
Range 1–32
d
0–31, specifies the power of 10 by which to divide the value. SAS uses the d
value even if the data contains decimal points. This argument is optional.
Details
Column-binary data storage compresses data so that more than 80 items of data
can be stored on a single “virtual” punch card.
The CBw.d informat reads standard numeric values from column-binary files and
translates the data into standard binary format.
SAS first stores each column of column-binary data that you read with CBw.d in 2
bytes and ignores the two high-order bits of each byte. If the punch codes are valid,
SAS stores the equivalent numeric value in the variable that you specify. If the
combinations are not valid, SAS assigns the variable a missing value and sets the
automatic variable _ERROR_ to 1.
612 Chapter 4 / Dictionary of Informats
Example: Examples
input @1 x cb8.;
Variable1 Result
----+----1
0009 9
1 The variable is a hexadecimal representation of the column binary. The “virtual” punch card column
for the example data has row 9 punched. The binary representation is 0000 0000 0000 1001.
See Also
n “Description of Column-Binary Data Storage” in SAS Programmer’s Guide:
Essentials
Informats
n “$CBw. Informat” on page 564
n “PUNCH.d Informat” on page 667
n “ROWw.d Informat” on page 673
COMMAw.d Informat
Removes embedded characters.
Categories: CAS
Numeric
Alias: DOLLARw.d
Syntax
COMMAw.d
Syntax Description
w
specifies the width of the input field.
Default 1
Range 1–32
COMMAXw.d Informat 613
d
specifies the power of 10 by which to divide the value. If the data contains
decimal points, the d value is ignored. This argument is optional.
Range 0–31
Details
The COMMAw.d informat reads numeric values and removes embedded commas,
blanks, dollar signs, percent signs, hyphens, and close parentheses from the input
data. The COMMAw.d informat converts an open parenthesis at the beginning of a
field to a minus sign.
Comparisons
The COMMAw.d informat operates like the COMMAXw.d informat, but it reverses
the roles of the decimal point and the comma. This convention is common in
European countries.
Example
data test;
value='$1,000,000';
value2=input(value,comma10.);
put value2 ;
run;
SAS writes the following output to the log:
1000000
COMMAXw.d Informat
Removes embedded periods, blanks, dollar signs, percent signs, hyphens, and close parentheses from the
input data. An open parenthesis at the beginning of a field is converted to a minus sign. The COMMAX
informat reverses the roles of the decimal point and the comma.
Categories: CAS
Numeric
Alias: DOLLARXw.d
614 Chapter 4 / Dictionary of Informats
Syntax
COMMAXw.d
Syntax Description
w
specifies the width of the input field.
Default 1
Range 1−32
d
specifies the power of 10 by which to divide the value. If the data contains a
comma, which represents a decimal point, the d value is ignored. This argument
is optional.
Range 0−31
Details
The COMMAXw.d informat reads numeric values and removes embedded periods,
blanks, dollar signs, percent signs, hyphens, and closing parentheses from the input
data. The COMMAXw.d informat converts an open parenthesis at the beginning of a
field to a minus sign.
Comparisons
The COMMAXw.d informat operates like the COMMAw.d informat, but it reverses
the roles of the decimal point and the comma. This convention is common in
European countries.
Example
data one;
input @1 x commax10.;
put x;
datalines;
$1.000.000
1.234,56
(500)
run;
SAS writes the following output to the log:
DATEw. Informat 615
1000000
1234.56
-500
DATEw. Informat
Reads date values in the form ddmmmyy or ddmmmyyyy.
Categories: CAS
Date
Syntax
DATEw.
Syntax Description
w
specifies the width of the input field.
Default 7
Range 7–32
Details
The date values must be in the form ddmmmyy or ddmmmyyyy.
dd
is an integer between 01 and 31 that represents the day of the month.
mmm
are the first three letters of the month name.
yy or yyyy
is a two-digit or four-digit integer that represents the year.
You can separate the year, month, and day values by blanks or special characters.
Ensure that the width of the input field allows space for blanks and special
characters.
Note: SAS interprets a two-digit year as part of the 100-year span that is defined by
the YEARCUTOFF= system option.
616 Chapter 4 / Dictionary of Informats
Example
data test;
date='28JAN2020';
sasdate=input(date,date9.);
put sasdate;
put sasdate date9;
run;
Variable Result
----+----1----+----20----+
See Also
Formats:
n “DATEw. Format” on page 169
Functions:
n “DATE Function” in SAS Functions and CALL Routines: Reference
System Options:
n “YEARCUTOFF= System Option” in SAS System Options: Reference
DATETIMEw. Informat
Reads datetime values in the form ddmmmyy hh:mm:ss.ss or ddmmmyyyy hh:mm:ss.ss.
Categories: CAS
Date and Time
Syntax
DATETIMEw.
DATETIMEw. Informat 617
Syntax Description
w
specifies the width of the input field.
Default 18
Range 13–40
Details
The datetime values must be in the following form: ddmmmyy or ddmmmyyyy,
followed by a blank or special character, followed by hh:mm:ss.ss (the time).
dd
is an integer between 01 and 31 that represents the day of the month.
mmm
are the first three letters of the month name.
yy or yyyy
is a two-digit or four-digit integer that represents the year.
hh
is an integer between 00 and 23 that represents hours.
mm
is an integer between 00 and 59 that represents minutes.
ss.ss
is the number of seconds that range from 00–59 with the fraction of a second
following the decimal point.
DATETIMEw. requires values for both the date and the time. However, the ss.ss
portion is optional.
Note: SAS interprets a two-digit year as part of the 100-year span that is defined by
the YEARCUTOFF= system option.
Comparisons
The DATETIMEw.d informat reads datetime values with optional separators in the
form dd-mmm-yy<yy> hh:mm:ss.ss AM | PM, and the date and time can be
separated by a special character.
The MDYAMPMw.d informat reads datetime values with optional separators in the
form mm-dd-yy<yy> hh:mm:ss.ss AM | PM, and requires a space between the date
and the time.
The YMDDTTMw.d informat reads datetime values with required separators in the
form <yy>yy-mm-dd/hh:mm:ss.ss.
618 Chapter 4 / Dictionary of Informats
Example
data test;
date='04MAY2018:13:33:18';
sasdate=input(date,datetime.);
put sasdate ;
put sasdate datetime20.;
run;
Variable Result
----+----1----+----2
See Also
n “Definitions for Dates, Times, and Intervals” on page 9
Formats:
n “DATEw. Format” on page 169
n “DATETIMEw.d Format” on page 172
n “TIMEw.d Format” on page 463
Functions:
n “DATETIME Function” in SAS Functions and CALL Routines: Reference
Informats:
n “DATEw. Informat” on page 615
n “MDYAMPMw.d Informat” on page 645
n “TIMEw. Informat” on page 700
n “YMDDTTMw.d Informat” on page 716
System Options:
n “YEARCUTOFF= System Option” in SAS System Options: Reference
DDMMYYw. Informat 619
DDMMYYw. Informat
Reads date values in the form ddmmyy<yy> or dd-mm-yy<yy>, where a special character such as a
hyphen (-), period (.), or slash (/) separates the day, month, and year. The year can be either two or four
digits.
Categories: CAS
Date
Syntax
DDMMYYw.
Syntax Description
w
specifies the width of the input field.
Default 6
Range 6–32
Details
The date values must be in the form ddmmyy<yy> or ddxmmxyy<yy>.
dd
is an integer between 01 and 31 that represents the day of the month.
mm
is an integer between 01 and 12 that represents the month.
yy or yyyy
is a two-digit or four-digit integer that represents the year.
x
is a separator that can be any special character or a blank space.
If you use separators, place them between all the values. Blanks can also be placed
before and after the date. Ensure that the width of the input field allows space for
blanks and special characters.
Note: SAS interprets a two-digit year as part of the 100-year span that is defined by
the YEARCUTOFF= system option.
620 Chapter 4 / Dictionary of Informats
Example
data test;
date='04/05/2018';
sasdate=input(date,ddmmyy10.);
put sasdate ;
put sasdate date9.;
run;
Variable Result
----+----1----+
See Also
Formats:
n “DATEw. Format” on page 169
n “DDMMYYw. Format” on page 175
n “MMDDYYw. Format” on page 235
n “YYMMDDw. Format” on page 496
Functions:
n “MDY Function” in SAS Functions and CALL Routines: Reference
Informats:
n “DATEw. Informat” on page 615
n “MMDDYYw. Informat” on page 647
n “YYMMDDw. Informat” on page 718
System Options:
n “YEARCUTOFF= System Option” in SAS System Options: Reference
E8601DAw. Informat
Reads date values that are specified using the ISO 8601 extended notation yyyy-mm-dd.
Categories: CAS
Date
E8601DAw. Informat 621
ISO 8601
Alignment: Left
Alias: IS8601DAw
Restriction: UTC time zone offset values are not supported.
Supports: ISO 8601 Element 5.2.1.1, complete representation
Syntax
E8601DAw.
Syntax Description
w
specifies the width of the input field.
Default 10
Details
The E8601DA informat reads date values that are specified in the ISO 8601
extended date notation yyyy-mm-dd.
yyyy
is a four-digit year.
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
Example
data one;
input eda e8601da.;
put eda;
datalines;
2018-09-15
;
run;
SAS writes the following output to the log:
21442
622 Chapter 4 / Dictionary of Informats
See Also
“Reading Dates and Times by Using the ISO 8601 Basic and Extended Notations”
on page 538
E8601DNw. Informat
Reads date values that are specified using the ISO 8601 extended notation yyyy-mm-dd and returns SAS
datetime values where the time portion of the value is 000000.
Categories: CAS
Date
ISO 8601
Alignment: Left
Alias: IS8601DNw
Restriction: UTC time zone offset values are not supported.
Supports: ISO 8601 Element 5.2.1.1, complete representation
Syntax
E8601DNw.
Syntax Description
w
specifies the width of the input field.
Default 10
Details
The E8601DN informat reads date values that are specified using the ISO 8601
extended date notation yyyy-mm-dd and returns the date in a SAS datetime value.
yyyy
is a four-digit year.
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
E8601DTw.d Informat 623
Example
data one;
input edn e8601dn.;
put edn;
datalines;
2018-09-15
;
run;
SAS writes the following output to the log:
1852588800
See Also
“Reading Dates and Times by Using the ISO 8601 Basic and Extended Notations”
on page 538
E8601DTw.d Informat
Reads datetime values that are specified using the ISO 8601 extended notation yyyy-mm-
ddThh:mm:ss.<ffffff>.
Categories: CAS
Date and Time
ISO 8601
Alignment: Left
Aliases: E8601LXw.d
IS8601DTw.d
Restriction: UTC time zone offset values are not supported.
Supports: ISO 8601 Element 5.4.1, complete representation
Syntax
E8601DTw.d
Syntax Description
w
specifies the width of the input field.
Default 19
624 Chapter 4 / Dictionary of Informats
Range 16–26
d
specifies the number of digits to the right of the decimal point in the seconds
value. This argument is optional.
Default 0
Range 0–6
Details
The E8601DT informat reads datetime values that are specified using the ISO 8601
extended datetime notation yyyy-mm-ddThh:mm:ss.<ffffff>.
yyyy
is a four-digit year.
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
ffffff
are optional fractional seconds, with a precision of up to six digits, where each
digit is between 0 and 9.
Note: If you specify a width of 16, SAS assumes that the value for seconds is 0 and
omits them from the output.
Example
data one;
input edt e8601dt.;
put edt;
datalines;
2018-09-15T15:53:00
;
run;
SAS writes the following output to the log:
1852645980
E8601DZw.d Informat 625
See Also
“Reading Dates and Times by Using the ISO 8601 Basic and Extended Notations”
on page 538
E8601DXw. Informat
Adjusts a Coordinated Universal Time (UTC) datetime value to the user’s local date and time. Then, reads
the local date and time by using the ISO 8601 datetime and time zone extended notation yyyy-mm-
ddThh:mm:ss+|–hh:mm.
See: The E8601DXw. informat uses the E8601DZw.d informat to read data. See
“E8601DZw.d Informat” on page 625.
Syntax
E8601DXw.
E8601DZw.d Informat
Reads Coordinated Universal Time (UTC) datetime values that are specified using the ISO 8601 datetime
extended notation yyyy-mm-ddThh:mm:ss+|–hh:mm.<fffff> or yyyy-mm-ddThh:mm:ss.<fffff>Z.
Categories: CAS
Date and Time
ISO 8601
Alignment: Left
Aliases: E8601DXw.d
IS8601DZw.d
Supports: ISO 8601 Element 5.4.1, complete representation
Syntax
E8601DZw.d
Syntax Description
w
specifies the width of the input field.
Default 26
626 Chapter 4 / Dictionary of Informats
Range 20–35
d
specifies the number of digits to the right of the decimal point in the value for the
lowest-order component. This argument is optional.
Default 0
Range 0–6
Details
UTC values specify a time and a time zone based on the zero meridian in
Greenwich, England. The E8601DZ informat reads datetime values that contain
UTC time offsets and that are specified in one of these ISO 8601 extended datetime
notations:
n yyyy-mm-ddThh:mm:ss.<ffffff>+|–hh:mm
n yyyy-mm-ddThh:mm:ss.<ffffff>Z
yyyy
is a four-digit year.
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
hh
is a two-digit hour (zero padded) between 00 and 24.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
ffffff
are optional fractional seconds, with a precision of up to six digits, where each
digit is between 0 and 9.
+|–hh:mm
is an hour and minute signed offset from zero meridian time. Note that the offset
must be +|–hh:mm (that is, + or – and five characters).
Use + for time zones east of the zero meridian, and use – for time zones west of
the zero meridian. For example, +02:00 indicates a two-hour time difference to
the east of the zero meridian, and –06:00 indicates a six-hour time difference to
the west of the zero meridian.
Restriction: The shorter form +|–hh is not supported.
Z
indicates that the time is UTC time at the zero meridian (Greenwich, England).
E8601LXw. Informat 627
Example
data one;
input edz e8601dz.;
put edz= edz=datetime22
datalines;
2018-09-15T15:53:00Z
;
run;
data one;
input edz e8601dz28.2;
put edz= edz=datetime22
datalines;
2018-09-15T15:53:00+03:00
;
run;
SAS writes the following output to the log:
edz=1852645980 edz=1852645980
edz=1852635180 edz=1852635180
See Also
“Reading Dates and Times by Using the ISO 8601 Basic and Extended Notations”
on page 538
E8601LXw. Informat
Reads datetime values as local time by appending a time zone offset difference between the local time and
UTC, using the ISO 8601 extended notation yyyy-mm-ddThh:mm:ss+|–hh:mm.
Restriction: This informat is not supported in a DATA step that runs in CAS.
See: The E8601LXw. informat uses the E8601DTw.d informat to read data. See “E8601DTw.d
Informat” on page 623.
Syntax
E8601LXw.
628 Chapter 4 / Dictionary of Informats
E8601LZw.d Informat
Reads Coordinated Universal Time (UTC) values that are specified using the ISO 8601 extended notation
hh:mm:ss+|–hh:mm.<fffff> or hh:mm:ss.<fffff>Z and converts the values to the local time.
Categories: Time
ISO 8601
Alignment: Left
Alias: IS8601LZw.d
Restriction: This informat is not supported in a DATA step that runs in CAS.
Supports: ISO 8601 Element 5.3.1.1, complete representation
Syntax
E8601LZw.d
Syntax Description
w
specifies the width of the input field.
Default 14
Range 9–20
Requirement To read a time with the Z time zone indicator, the width of the
input field must be 9 if more data follows the time on the same line
of data.
d
specifies the number of digits to the right of the decimal point in the value for the
lowest-order component. This argument is optional.
Default 0
Range 0–6
Details
UTC values specify a time and a time zone based on the zero meridian in
Greenwich, England. The E8601LZ informat reads UTC time values that are
specified in one of these ISO 8601 extended time notations and returns a SAS time
value for the local time:
n hh:mm:ss.<ffffff>+|–hh:mm
E8601LZw.d Informat 629
n hh:mm:ss.<ffffff>Z
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
ffffff
are optional fractional seconds, with a precision of up to six digits, where each
digit is between 0 and 9.
+|–hh:mm
is an hour and minute signed offset from zero meridian. Note that the offset must
be +|–hh:mm (that is, + or – and five characters).
Use the + for time zones east of the zero meridian, and use the – for time zones
west of the zero meridian.
Restriction: The shorter form +|–hh is not supported.
Z
indicates zero meridian or +00:00 UTC time.
When SAS reads a UTC time by using the E8601LZ informat and the adjusted time
is greater than 24:00:00 or less than 00:00:00, SAS adjusts the value so that the
time is between 00:00:00 and 24:00:00. For example, if SAS reads the UTC time
23:43:44-05:00 by using the E8601LZ informat, SAS adds five hours to the time so
that the value is 28:43:44, and then makes the time adjustment. The value stored
represents the time 04:43:44+00:00.
Example
data one;
input edz e8601lz.;
put etz= etz=time8.;
datalines;
09:13:21+02:00
23:43:44Z
;
run;
SAS writes the following output to the log:
edz=8001 edz=2:13:21
edz=85424 edz=23:43:44
See Also
“Reading Dates and Times by Using the ISO 8601 Basic and Extended Notations”
on page 538
630 Chapter 4 / Dictionary of Informats
E8601TMw.d Informat
Reads time values that are specified using the ISO 8601 extended notation hh:mm:ss.<ffffff>.
Categories: CAS
Time
ISO 8601
Alignment: Left
Alias: IS8601TMw.d
Restriction: UTC time zone offset values are not supported.
Supports: ISO 8601 Elements 5.3.1.1 and 5.3.1.3, complete representation and representation of
decimal fractions
Syntax
E8601TMw.d
Syntax Description
w
specifies the width of the input field.
Default 8
Range 8–15
d
specifies the number of digits to the right of the decimal point in the seconds
value. This argument is optional.
Default 0
Range 0–6
Details
The E8601TM informat reads time values that are specified using the ISO 8601
extended time notation hh:mm:ss.<ffffff>.
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
E8601TZw.d Informat 631
ss
is a two-digit second (zero padded) between 00 and 59.
ffffff
are optional fractional seconds, with a precision of up to six digits, where each
digit is between 0 and 9.
Example
data one;
input edm e8601tm.;
put edm;
datalines;
15:53:00
;
run;
SAS writes the following output to the log:
57180
See Also
“Reading Dates and Times by Using the ISO 8601 Basic and Extended Notations”
on page 538
E8601TXw. Informat
Adjusts a Coordinated Universal Time (UTC) value to the user’s local time. Then, reads the local time by
using the ISO 8601 extended time notation hh:mm:ss+|–hh:mm.
Restriction: This informat is not supported in a DATA step that runs in CAS.
See: The E8601TXw. informat uses the E8601TZw.d informat to read data. See “E8601DZw.d
Informat” on page 625.
Syntax
E8601TXw.
E8601TZw.d Informat
Reads time values that are specified using the ISO 8601 extended time notation hh:mm:ss+|–
hh:mm.<ffffff> or hh:mm:ssZ.
632 Chapter 4 / Dictionary of Informats
Categories: CAS
Time
ISO 8601
Alignment: Left
Aliases: E8601TXw.d
IS8601TZw.d
Supports: ISO 8601 Element 5.3.1.1, complete representation
Syntax
E8601TZw.d
Syntax Description
w
specifies the width of the input field.
Default 14
Range 9−20
Requirement To read a time with the Z time zone indicator, the width of the
input field must be 9 if more data follows the time on the same line
of data.
d
specifies the number of digits to the right of the decimal point in the value for the
lowest-order component. This argument is optional.
Default 0
Range 0−6
Details
UTC time values specify a time and a time zone based on the zero meridian in
Greenwich, England. The E8601TZ informat reads UTC time values that are
specified in one of these ISO 8601 extended notations:
n hh:mm:ss+|–hh:mm.<ffffff>
n hh:mm:ssZ
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
FLOATw.d Informat 633
ffffff
are optional fractional seconds, with a precision of up to six digits, where each
digit is between 0 and 9.
+|–hh:mm
is an hour and minute signed offset from zero meridian. Note that the offset must
be +|–hh:mm (that is, + or – and five characters).
Use the + for time zones east of the zero meridian, and use the – for time zones
west of the zero meridian.
Restriction: The shorter form +|–hh is not supported.
Z
indicates zero meridian or +00:00 UTC time.
When SAS reads a UTC time by using the E8601TZ informat and the adjusted time
is greater than 24:00:00 or less than 00:00:00, SAS adjusts the value so that the
time is between 00:00:00 and 24:00:00. For example, if SAS reads the UTC time
23:43:44–05:00 by using the E8601TZ informat, SAS adds five hours to the time so
that the value is 28:43:44, and then makes the time adjustment. The value stored
represents the time 04:43:44+00:00.
Example
data one;
input etz e8601tz.;
put etz= etz=time8.;
datalines;
23:43:44-05:00
23:43:44Z
;
run;
SAS writes the following output to the log:
etz=17024 etz=4:43:44
etz=85424 etz=23:43:44
See Also
“Reading Dates and Times by Using the ISO 8601 Basic and Extended Notations”
on page 538
FLOATw.d Informat
Reads a native single-precision, floating-point value and divides it by 10 raised to the dth power.
Categories: CAS
Numeric
634 Chapter 4 / Dictionary of Informats
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
Syntax
FLOATw.d
Syntax Description
w
specifies the width of the input field.
Requirement w must be 4.
d
specifies the power of 10 by which to divide the value. This argument is optional.
Details
The FLOATw.d informat is useful in operating environments where a float value is
not the same as a truncated double.
On the IBM mainframe systems, a 4-byte floating-point number is the same as a
truncated 8-byte floating-point number. However, in operating environments that use
the IEEE floating-point standard, such as the IBM PC-based operating environments
and most UNIX platforms, a 4-byte floating-point number is not the same as a
truncated double. Therefore, the RB4. informat does not produce the same results
as FLOAT4. Floating-point representations other than IEEE might have this same
characteristic. Values read with FLOAT4. typically come from some other external
program that is running in your operating environment.
Comparisons
The following table compares the names of float notation in several programming
languages:
SAS FLOAT4.
Fortran REAL*4
C float
Example
input x float4.;
Variable1 Result
----+----1----+----2
3F800000 1
1 The variable is a hexadecimal representation of a binary number that is stored in IEEE form.
HEXw. Informat
Converts hexadecimal positive binary values to either integer (fixed-point) or real (floating-point) binary
values.
Categories: CAS
Numeric
See: “HEX Informat: UNIX” in SAS Companion for UNIX Environments
“HEXw. Informat: Windows” in SAS Companion for Windows
“HEXw. Informat: z/OS” in SAS Companion for z/OS
Syntax
HEXw.
Syntax Description
w
specifies the field width of the input value and also specifies whether the final
value is fixed-point or floating-point.
Default 8
Range 1–16
Tip If w<16, HEXw. converts the input value to positive integer binary
values, treating all input values as positive (unsigned). If w is 16,
636 Chapter 4 / Dictionary of Informats
Details
Operating Environment Information: Different operating environments store
floating-point values in different ways. However, HEX16. reads hexadecimal
representations of floating-point values with consistent results if the values are
expressed in the same way that your operating environment stores them.
The HEXw. informat ignores leading or trailing blanks.
Example
data _null_;
a=input('88F'x,hex3.);
b=input('4152000000000000'x,hex16.);
put a= b=;
run;
SAS writes the following to the log:
a=2191 b=4718592
HHMMSSw. Informat
Reads hours, minutes, and seconds in the form hh:mm:ss or hhmmss.
Categories: CAS
Time
Syntax
HHMMSSw.
Syntax Description
w
specifies the width of the input field.
Default 8
Range 1–20
HHMMSSw. Informat 637
Details
The HHMMSSw. informat reads SAS time values in one of these forms:
n hh:mm:ss
n hhmmss
hh
is an integer that represents the number of hours.
:
represents a special character that separates hours, minutes, and seconds.
mm
is an integer that represents the number of minutes.
ss
is an integer that represents the number of seconds. Fractional seconds are
ignored.
If the input data is six digits, SAS reads the data from left to right as hours, minutes,
and seconds. For data that is less than six digits, SAS follows these rules:
n If the number has an odd number of digits, SAS pads a zero to the left of the first
digit. Then, SAS pads after the last digit to the right with zeros until there are six
digits.
n If the number has an even number of digits, SAS pads zeros to the right of the
last digit until there are six digits.
The first two digits are read as hours. Digits three and four are read as minutes.
Digits five and six are read as seconds.
Example
data test;
time='12:45:44';
sastime=input(time,hhmmss.);
put sastime ;
put sastime time8.;
run;
Variable Result
----+----1----+
See Also
Informats:
n “TIMEw. Informat” on page 700
IBw.d Informat
Reads native integer binary (fixed-point) values, including negative values.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
See: “IB Informat: UNIX” in SAS Companion for UNIX Environments
“IBw.d Informat: Windows” in SAS Companion for Windows
“IBw.d Informat: z/OS” in SAS Companion for z/OS
Syntax
IBw.d
IBw.d Informat 639
Syntax Description
w
specifies the width of the input field.
Default 4
Range 1–8
d
specifies the power of 10 by which to divide the value. This argument is optional.
Range 0–10
Details
The IBw.d informat reads integer binary (fixed-point) values, including negative
values represented in two's-complement notation. IBw.d reads integer binary values
with consistent results if the values are created in the same type of operating
environment that you use to run SAS.
Comparisons
The IBw.d and PIBw.d informats are used to read native format integers. (Native
format enables you to read and write values created in the same operating
environment.) The IBRw.d and PIBRw.d informats are used to read little endian
integers in any operating environment.
To view a table that shows the type of informat to use with big endian and little
endian integers, see “Reading Data Generated on Big Endian and Little Endian
Platforms” on page 531.
To view a table that compares integer binary notation in several programming
languages, see “Integer Binary Notation and Different Programming Languages” on
page 38.
Example
You can use the INPUT statement and specify the IB informat. However, these
examples use the informat with the INPUT function, where binary input values are
described using a hexadecimal literal.
data one;
640 Chapter 4 / Dictionary of Informats
result=input('0080'x,ib4.);
put result;
run;
See Also
Informats:
n “IBRw.d Informat” on page 640
IBRw.d Informat
Reads integer binary (fixed-point) values in Intel and DEC formats.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
Syntax
IBRw.d
Syntax Description
w
specifies the width of the input field.
Default 4
Range 1–8
d
specifies the power of 10 by which to divide the value. This argument is optional.
Range 0–10
IBRw.d Informat 641
Details
The IBRw.d informat reads integer binary (fixed-point) values, including negative
values that are represented in two's-complement notation. IBRw.d reads integer
binary values that are generated by and for Intel and DEC platforms. Use IBRw.d to
read integer binary data from Intel or DEC environments in other operating
environments. The IBRw.d informat in SAS code allows for a portable
implementation for reading the data in any operating environment.
Comparisons
The IBw.d and PIBw.d informats are used to read native format integers. (Native
format enables you to read and write values that are created in the same operating
environment.) The IBRw.d and PIBRw.d informats are used to read little endian
integers in any operating environment.
In Intel and DEC operating environments, the IBw.d and IBRw.d informats are
equivalent.
To view a table that shows the type of informat to use with big endian and little
endian integers, see “Reading Data Generated on Big Endian and Little Endian
Platforms” on page 531.
To view a table that compares integer binary notation in several programming
languages, see “Integer Binary Notation and Different Programming Languages” on
page 38.
Example
You can use the INPUT statement and specify the IBR informat. However, in these
examples, we use the informat with the INPUT function, where binary input values
are described using a hexadecimal literal.
data one;
x=input('0100'x,ibr2.);
y=input('0001'x,ibr2.);
result=input('80000000'x,ibr4.);
put x;
put y;
put result;
run;
642 Chapter 4 / Dictionary of Informats
put x; 1 1
See Also
Informats:
n “IBw.d Informat” on page 638
IEEEw.d Informat
Reads an IEEE floating-point value and divides it by 10 raised to the dth power.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
Syntax
IEEEw.d
Syntax Description
w
specifies the width of the input field.
Default 4
Range 3–8
d
specifies the power of 10 by which to divide the value.
Details
The IEEEw.d informat is useful in operating environments where IEEE is the
floating-point representation that is used. In addition, you can use the IEEEw.d
informat to read files that are created by programs in operating environments that
use the IEEE floating-point representation.
Typically, programs generate IEEE values in single precision (4 bytes) or double
precision (8 bytes). Truncation is performed by programs solely to save space on
output files. Machine instructions require that the floating-point number be one of
the two lengths. The IEEEw.d informat allows other lengths, which enables you to
read data from files that contain space-saving truncated data.
Example
The variables are hexadecimal representations of binary numbers that are stored in
IEEE format.
data _null_;
a=input('3F800000'x,ieee4.);
b=input('3FF0000000'x,ieee5.);
put a= b=;
run;
SAS writes the following to the log:
a=1 b=1
JULIANw. Informat
Reads Julian dates in the form yyddd or yyyyddd.
Categories: CAS
Date and Time
See: “Julian Date Formats and Astronomical Dates” on page 10
Syntax
JULIANw.
644 Chapter 4 / Dictionary of Informats
Syntax Description
w
specifies the width of the input field.
Default 5
Range 5–32
Details
The date values must be in one of these forms:
n yyddd
n yyyyddd
yy or yyyy
is a two-digit or four-digit integer that represents the year.
dd or ddd
is an integer from 01–365 that represents the day of the year.
Julian dates consist of strings of contiguous numbers, which means that zeros must
pad any space between the year and the day values.
Julian dates that contain year values before 1582 are invalid for the conversion to
Gregorian dates.
Note: SAS interprets a two-digit year as part of the 100-year span that is defined by
the YEARCUTOFF= system option.
Example
data test;
date='2018099';
sasdate=input(date,julian7.);
put sasdate ;
put sasdate date9.;
run;
Variable Result
----+----1----+
See Also
Formats:
n “JULIANw. Format” on page 232
Functions:
n “DATEJUL Function” in SAS Functions and CALL Routines: Reference
n “JULDATE Function” in SAS Functions and CALL Routines: Reference
System Options:
n “YEARCUTOFF= System Option” in SAS System Options: Reference
MDYAMPMw.d Informat
Reads datetime values in the form mm-dd-yy<yy> hh:mm:ss.ss AM|PM, where a special character such as
a hyphen (-), period (.), slash (/), or colon (:) separates the month, day, and year. The year can be either
two or four digits.
Categories: CAS
Date and Time
Alignment: Right
Requirement: A space must separate the date and the time.
Note: The default time period is AM.
Syntax
MDYAMPMw.d
Syntax Description
w
specifies the width of the output field.
Default 19
Range 8–40
d
specifies the number of digits to the right of the decimal point in the seconds
value. The digits to the right of the decimal point specify a fraction of a second.
This argument is optional.
Default 0
646 Chapter 4 / Dictionary of Informats
Range 0–39
Details
The MDYAMPMw.d format reads SAS datetime values in the form mm-dd-yy<yy>
hh:mm<:ss<.ss>> <AM | PM>.
mm
is an integer between 01 and 12 that represents the month.
dd
is an integer between 01 and 31 that represents the day of the month.
yy or yyyy
specifies a two-digit or four-digit integer that represents the year.
hh
is an integer between 00 and 23 that represents hours.
mm
is an integer between 00 and 59 that represents minutes.
ss.ss
is the number of seconds that range from 00–59 with the fraction of a second
following the decimal point.
Requirement: If a fraction of a second is specified, the decimal point can be
represented only by a period and is required.
AM | PM
specifies either the time period 00:01–12:00 noon (AM) or the time period 12:01–
12:00 midnight ( PM).
- or :
represents one of several special characters such as the slash (/), hyphen (-),
colon (:), or a blank character that can be used to separate date and time
components. Special characters can be used as separators between any date or
time component and between the date and the time.
Comparisons
The MDYAMPMw.d informat reads datetime values with optional separators in the
form mm-dd-yy<yy> hh:mm:ss.ss AM | PM, and requires a space between the date
and the time.
The DATETIMEw.d informat reads datetime values with optional separators in the
form dd-mmm-yy<yy> hh:mm:ss.ss AM|PM, and the date and time can be
separated by a special character.
The YMDDTTMw.d informat reads datetime values with required separators in the
form <yy>yy-mm-dd/hh:mm:ss.ss.
MMDDYYw. Informat 647
Example
data test;
date='04-30-18 3:27 pm';
sasdate=input(date,mdyampm.);
put sasdate ;
put sasdate datetime20.;
run;
Variable Result
See Also
Informats:
n “DATETIMEw. Informat” on page 616
n “YMDDTTMw.d Informat” on page 716
MMDDYYw. Informat
Reads date values in the form mmddyy or mmddyyyy.
Categories: CAS
Date
Syntax
MMDDYYw.
Syntax Description
w
specifies the width of the input field.
Default 6
Range 6–32
648 Chapter 4 / Dictionary of Informats
Details
The date values must be in one of these forms:
n mmddyy
n mmddyyyy
mm
is an integer between 01 and 12 that represents the month.
dd
is an integer between 01 and 31 that represents the day of the month.
yy or yyyy
is a two-digit or four-digit integer that represents the year.
You can separate the month, day, and year fields by blanks or special characters.
However, if you use delimiters, place them between all fields in the value. Blanks
can also be placed before and after the date.
Note: SAS interprets a two-digit year as part of the 100-year span that is defined by
the YEARCUTOFF= system option.
Example
data test;
date='05/04/2018';
sasdate=input(date,mmddyy10.);
put sasdate ;
put sasdate date9.;
run;
Variable Result
----+----1----+
See Also
Formats:
n “DATEw. Format” on page 169
n “DDMMYYw. Format” on page 175
n “MMDDYYw. Format” on page 235
MONYYw. Informat 649
Functions:
n “DAY Function” in SAS Functions and CALL Routines: Reference
n “MDY Function” in SAS Functions and CALL Routines: Reference
n “MONTH Function” in SAS Functions and CALL Routines: Reference
n “YEAR Function” in SAS Functions and CALL Routines: Reference
Informats:
n “DATEw. Informat” on page 615
n “DDMMYYw. Informat” on page 619
n “YYMMDDw. Informat” on page 718
System Options:
n “YEARCUTOFF= System Option” in SAS System Options: Reference
MONYYw. Informat
Reads month and year date values in the form mmmyy or mmmyyyy.
Categories: CAS
Date
Syntax
MONYYw.
Syntax Description
w
specifies the width of the input field.
Default 5
Range 5–32
Details
The date values must be in one of these forms:
n mmmyy
n mmmyyyy
650 Chapter 4 / Dictionary of Informats
mmm
are the first three letters of the month name.
yy or yyyy
is a two-digit or four-digit integer that represents the year.
A value read with the MONYYw. informat results in a SAS date value that
corresponds to the first day of the specified month.
Note: SAS interprets a two-digit year as part of the 100-year span that is defined by
the YEARCUTOFF= system option.
Example
data test;
date='MAY2018';
sasdate=input(date,monyy7.);
put sasdate ;
put sasdate date9.;
run;
Variable Result
----+----1
See Also
Formats:
n “DDMMYYw. Format” on page 175
n “MMDDYYw. Format” on page 235
n “MONYYw. Format” on page 247
n “YYMMDDw. Format” on page 496
Functions:
n “MONTH Function” in SAS Functions and CALL Routines: Reference
n “YEAR Function” in SAS Functions and CALL Routines: Reference
Informats:
n “DDMMYYw. Informat” on page 619
n “MMDDYYw. Informat” on page 647
MSECw. Informat 651
System Options:
n “YEARCUTOFF= System Option” in SAS System Options: Reference
MSECw. Informat
Reads TIME MIC values.
Categories: CAS
Time
Syntax
MSECw.
Syntax Description
w
specifies the width of the input field.
Details
The MSECw. informat reads time values that are produced by IBM mainframe
operating environments and converts the time values to SAS time values.
Use the MSECw. informat to find the difference between two IBM mainframe TIME
values, with precision to the nearest microsecond.
Comparisons
The MSECw. and TODSTAMPw. informats both read IBM time-of-day clock values,
but the MSECw. informat assigns a time value to a variable, and the TODSTAMPw.
informat assigns a datetime value.
652 Chapter 4 / Dictionary of Informats
Example
The input time used in this example is the hexadecimal timestamp
‘0000EA044E65A000’ that corresponds to 5:26:58 p.m.
data _null_;
x=input('0000EA044E65A000'x,msec8.);
put x=timeampm.;
run;
SAS writes the following to the log:
x=5:26:58 PM
See Also
Informats:
n “TODSTAMPw. Informat” on page 702
NUMXw.d Informat
Reads numeric values with a comma in place of the decimal point.
Categories: CAS
Numeric
Syntax
NUMXw.d
Syntax Description
w
specifies the width of the input field.
Default 12
Range 1–32
d
specifies the number of digits to the right of the decimal. If the data contains
decimal points, the d value is ignored. This argument is optional.
Range 0–31
OCTALw.d Informat 653
Details
The NUMXw.d informat reads numeric values and interprets a comma as a decimal
point.
Comparisons
The NUMXw.d informat is similar to the w.d informat, except that it reads numeric
values that contain a comma in place of the decimal point.
Example
data one;
input @1 x numx10.;
put x;
datalines;
896,48
3064,1
6489
;
run;
SAS writes the following output to the log:
896.48
3064.1
6489
See Also
Formats:
n “NUMXw.d Format” on page 417
n “w.d Format” on page 474
OCTALw.d Informat
Converts positive octal values to integers.
Category: Numeric
Restriction: This informat is not supported in a DATA step that runs in CAS.
654 Chapter 4 / Dictionary of Informats
Syntax
OCTALw.d
Syntax Description
w
specifies the width of the input field.
Default 3
Range 1–24
d
specifies the power of 10 by which to divide the value. This argument is optional.
Range 1–31
Details
Use only the digits 0 through 7 in the input, with no embedded blanks. The
OCTALw.d informat ignores leading and trailing blanks.
OCTALw.d cannot read negative values. It treats all input values as positive
(unsigned).
Example
data one;
input @1 x octal13.1;
put x;
datalines;
177
;
run;
SAS writes the following output to the log:
12.7
PDw.d Informat
Reads data that is stored in IBM packed decimal format.
PDw.d Informat 655
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
See: “PD Informat: UNIX” in SAS Companion for UNIX Environments
“PDw.d Informat: Windows” in SAS Companion for Windows
“PDw.d Informat: z/OS” in SAS Companion for z/OS
Syntax
PDw.d
Syntax Description
w
specifies the width of the input field.
Default 1
Range 1–16
d
specifies the power of 10 by which to divide the value. This argument is optional.
Range 0–10
Details
The PDw.d informat is useful because many programs write data in packed decimal
format for storage efficiency, fitting two digits into each byte and using only a half
byte for a sign.
The PDw.d format writes missing numerical data as –0. When the PDw.d informat
reads –0, it stores it as 0.
Comparisons
The following table compares packed decimal notation in several programming
languages:
656 Chapter 4 / Dictionary of Informats
Language Notation
SAS PD4.
a=123
PDJULGw. Informat
Reads packed Julian date values in the hexadecimal form yyyydddF for IBM.
Category: Date
Restriction: This informat is not supported in a DATA step that runs in CAS.
Syntax
PDJULGw.
Syntax Description
w
specifies the width of the input field.
Default 4
Range 3–16
PDJULGw. Informat 657
Details
The PDJULGw. informat reads IBM packed Julian date values in the form yyyydddF:
yyyy
is the 2-byte representation of the four-digit Gregorian year.
ddd
is the 1 1/2-byte representation of the three-digit integer that corresponds to the
Julian day of the year, 1–365 (or 1–366 for leap years).
F
is the half byte that contains all binary 1s, which assigns the value as positive.
Note: SAS interprets a two-digit year as part of the 100-year span that is defined by
the YEARCUTOFF= system option.
Example
data a;
x=input('2018003F'x,pdjulg4.);
format x mmddyy10.;
put x=;
run;
SAS writes the following output to the log:
01/03/2018
See Also
Formats:
n “JULDAYw. Format” on page 230
n “JULIANw. Format” on page 232
n “PDJULGw. Format” on page 424
n “PDJULIw. Format” on page 426
Functions:
n “DATEJUL Function” in SAS Functions and CALL Routines: Reference
n “JULDATE Function” in SAS Functions and CALL Routines: Reference
Informats:
n “JULIANw. Informat” on page 643
n “PDJULIw. Informat” on page 658
658 Chapter 4 / Dictionary of Informats
System Options:
n “YEARCUTOFF= System Option” in SAS System Options: Reference
PDJULIw. Informat
Reads packed Julian dates in the hexadecimal format ccyydddF for IBM.
Category: Date
Restriction: This informat is not supported in a DATA step that runs in CAS.
Syntax
PDJULIw.
Syntax Description
w
specifies the width of the input field.
Default 4
Range 3–16
Details
The PDJULIw. informat reads IBM packed Julian date values in the form ccyydddF:
cc
is the 1-byte representation of a two-digit integer that represents the century.
yy
is the 1-byte representation of a two-digit integer that represents the year. The
PDJULIw informat makes an adjustment to the 1-byte century representation by
adding 1900 to the 2-byte ccyy value in order to produce the correct four-digit
Gregorian year. This adjustment causes ccyy values of 0098 to become 1998,
0101 to become 2001, and 0218 to become 2118.
ddd
is the 1 1/2- byte representation of the three-digit integer that corresponds to the
Julian day of the year, 1–365 (or 1–366 for leap years).
F
is the half byte that contains all binary 1s, which assigns the value as positive.
PDTIMEw. Informat 659
Example
data a;
x=input('0118019F'x,pdjuli4.);
format x mmddyy10.;
put x;
run;
SAS writes the following output to the log:
01/19/2018
See Also
Formats:
n “JULDAYw. Format” on page 230
n “JULIANw. Format” on page 232
n “PDJULGw. Format” on page 424
n “PDJULIw. Format” on page 426
Functions:
n “DATEJUL Function” in SAS Functions and CALL Routines: Reference
n “JULDATE Function” in SAS Functions and CALL Routines: Reference
Informats:
n “JULIANw. Informat” on page 643
n “PDJULGw. Informat” on page 656
System Options:
n “YEARCUTOFF= System Option” in SAS System Options: Reference
PDTIMEw. Informat
Reads packed decimal time of SMF and RMF records.
Categories: CAS
Time
Syntax
PDTIMEw.
660 Chapter 4 / Dictionary of Informats
Syntax Description
w
specifies the width of the input field.
Details
The PDTIMEw. informat reads packed decimal time values that are contained in
SMF and RMF records that are produced by IBM mainframe systems and converts
the values to SAS time values.
The general form of a packed decimal time value in hexadecimal notation is
0hhmmssF.
0
is a half-byte that contains all 0s.
hh
is 1 byte that represents two digits that correspond to hours.
mm
is 1 byte that represents two digits that correspond to minutes.
ss
is 1 byte that represents two digits that correspond to seconds.
F
is a half-byte that contains all 1s.
If a field contains all 0s, PDTIMEw. treats it as a missing value.
PDTIMEw. enables you to read packed decimal time values from files that are
created on an IBM mainframe in any operating environment.
Example
The variable is a hexadecimal representation of a binary time value that is stored in
packed decimal form. Each byte occupies one column of the input field. The result is
a SAS time value that corresponds to 2:22.25 p.m.
data _null_;
a=input('0142225F'x,pdtime.);
put a=;
run;
SAS writes the following to the log:
a=51745
PERCENTw.d Informat 661
PERCENTw.d Informat
Reads percentages as numeric values.
Categories: CAS
Numeric
Syntax
PERCENTw.d
Syntax Description
w
specifies the width of the input field.
Default 6
Range 1–32
d
specifies the power of 10 by which to divide the value. If the data contains
decimal points, the d value is ignored. This argument is optional.
Range 0–31
Details
The PERCENTw.d informat converts the numeric portion of the input data to a
number using the same method as the COMMAw.d informat. If a percent sign (%)
follows the number in the input field, PERCENTw.d divides the number by 100.
Example
data test;
value='23.48%';
percent=input(value,percent7.2);
put percent;
run;
SAS writes the following output to the log:
0.2348
662 Chapter 4 / Dictionary of Informats
PIBw.d Informat
Reads positive integer binary (fixed-point) values.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
See: “PIB Informat: UNIX” in SAS Companion for UNIX Environments
“PIBw.d Informat: Windows” in SAS Companion for Windows
Syntax
PIBw.d
Syntax Description
w
specifies the width of the input field.
Default 1
Range 1–8
d
specifies the power of 10 by which to divide the value. This argument is optional.
Range 0–10
Details
All values are treated as positive. PIBw.d reads positive integer binary values with
consistent results if the values are created in the same type of operating
environment that you use to run SAS.
Comparisons
n Positive integer binary values are the same as integer binary values, except that
the sign bit is part of the value, which is always a positive integer. The PIBw.d
informat treats all values as positive and includes the sign bit as part of the
value.
n The PIBw.d informat with a width of 1 results in a value that corresponds to the
binary equivalent of the contents of a byte. The binary equivalent of the contents
of a byte is useful if your data contains values between hexadecimal 80 and
hexadecimal FF, where the high-order bit can be misinterpreted as a negative
sign.
n The IBw.d and PIBw.d informats are used to read native format integers. (Native
format enables you to read and write values that are created in the same
operating environment.) The IBRw.d and PIBRw.d informats are used to read
little endian integers in any operating environment.
To view a table that shows the type of informat to use with big endian and little
endian integers, see “Reading Data Generated on Big Endian and Little Endian
Platforms” on page 531.
To view a table that compares integer binary notation in several programming
languages, see “Integer Binary Notation and Different Programming Languages”
on page 38.
Example
You can use the INPUT statement and specify the PIB informat. However, in these
examples, we use the informat with the INPUT function, where binary input values
are described by using a hexadecimal literal.
data _null_;
result=input('A',pib1.);
put result;
run;
data _null_;
x=input('0100'x,pib2.);
y=input('0001'x,pib2.);
put x ;
put y;
run;
put x; 256 1
put y; 1 256
664 Chapter 4 / Dictionary of Informats
See Also
Informats:
n “PIBRw.d Informat” on page 664
PIBRw.d Informat
Reads positive integer binary (fixed-point) values in Intel and DEC formats.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
Syntax
PIBRw.d
Syntax Description
w
specifies the width of the input field.
Default 1
Range 1–8
d
specifies the power of 10 by which to divide the value. This argument is optional.
Range 0–10
Details
All values are treated as positive. PIBRw.d reads positive integer binary values that
have been generated by and for Intel and DEC operating environments. Use
PIBRw.d to read positive integer binary data from Intel and DEC environments in
other operating environments. The PIBRw.d informat in SAS code allows for a
portable implementation for reading the data in any operating environment.
byte ordering, see “Byte Ordering for Integer Binary Data on Big Endian and Little
Endian Platforms” on page 530 .
Comparisons
n Positive integer binary values are the same as integer binary values, except that
the sign bit is part of the value, which is always a positive integer. The PIBRw.d
informat treats all values as positive and includes the sign bit as part of the
value.
n The PIBRw.d informat with a width of 1 results in a value that corresponds to the
binary equivalent of the contents of a byte. This is useful if your data contains
values between hexadecimal 80 and hexadecimal FF, where the high-order bit
can be misinterpreted as a negative sign.
n On Intel and DEC platforms, the PIBw.d and PIBRw.d informats are equivalent.
n The IBw.d and PIBw.d informats are used to read native format integers. (Native
format enables you to read and write values that are created in the same
operating environment.) The IBRw.d and PIBRw.d informats are used to read
little endian integers in any operating environment.
To view a table that shows the type of informat to use with big endian and little
endian integers, see “Reading Data Generated on Big Endian and Little Endian
Platforms” on page 531.
To view a table that compares integer binary notation in several programming
languages, see “Integer Binary Notation and Different Programming Languages”
on page 38.
Example
data _null_;
x=input('0100'x,pibr2.);
y=input('0001'x,pibr2.);
put x y;
run;
You can use the INPUT statement and specify the PIBR informat. However, these
examples use the informat with the INPUT function, where binary input values are
described using a hexadecimal literal.
put x; 1 1
put y; 256 256
666 Chapter 4 / Dictionary of Informats
See Also
Informat
n “PIBw.d Informat” on page 662
PKw.d Informat
Reads unsigned packed decimal data.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
Syntax
PKw.d
Syntax Description
w
specifies the number of bytes of unsigned packed decimal data. Each byte
contains two digits.
Default 1
Range 1–16
d
specifies the power of 10 by which to divide the value. This argument is optional.
Range 0–10
Details
Each byte of unsigned packed decimal data contains two digits.
Comparisons
The PKw.d informat is the same as the PDw.d informat, except that PKw.d treats
the sign half of the field's last byte as part of the value, not as the sign of the value.
PUNCH.d Informat 667
Example
The variable in this example is a hexadecimal representation of a binary number
stored in unsigned packed decimal form.
data _null_;
a='001234'x;
b=input(a, pk3.);
put b=;
run;
SAS writes the following to the log:
b=1234
PUNCH.d Informat
Reads whether a row of column-binary data is punched.
Categories: CAS
Column Binary
Syntax
PUNCH.d
Syntax Description
d
specifies which row in a card column to read.
Range 1–12
Details
Column-binary data storage compresses data so that more than 80 items of data
can be stored on a single “virtual” punch card.
This informat assigns the value 1 to the variable if row d of the current card column
is punched, or 0 if row d of the current card column is not punched. After PUNCH.d
reads a field, the pointer does not advance to the next column.
668 Chapter 4 / Dictionary of Informats
Example
data one;
input x punch.12;
put x;
datalines;
12-7-8
;
run;
SAS writes the following output to the log:
See Also
n “Description of Column-Binary Data Storage” in SAS Programmer’s Guide:
Essentials
Informats:
n “$CBw. Informat” on page 564
n “CBw.d Informat” on page 611
n “ROWw.d Informat” on page 673
RBw.d Informat
Reads numeric data that is stored in real binary (floating-point) notation.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
See: “RB Informat: UNIX” in SAS Companion for UNIX Environments
“RBw.d Informat: Windows” in SAS Companion for Windows
“RBw.d Informat: z/OS” in SAS Companion for z/OS
Syntax
RBw.d
RBw.d Informat 669
Syntax Description
w
specifies the width of the input field.
Default 4
Range 2–8
d
specifies the power of 10 by which to divide the value. This argument is optional.
Range 0–10
Details
Note: Different operating environments store real binary values in different ways.
However, the RBw.d informat reads real binary values with consistent results if the
values are created on the same type of operating environment that you use to run
SAS.
Comparisons
The following table compares the names of real binary notation in several
programming languages:
C float double
CAUTION
Using the RBw.d informat to read real binary information on equipment that
conforms to the IEEE standard for floating-point numbers results in a
truncated 8-byte number (double-precision) instead of a true 4-byte floating-
point number (single-precision).
670 Chapter 4 / Dictionary of Informats
Example
This example uses a hexadecimal representation of a real binary (floating-point)
number.
data _null_;
a='0000000000006040'x;
b=input(a, rb8.);
put b=;
run;
SAS writes the following output to the log:
b=128
See Also
Informats:
n “IEEEw.d Informat” on page 642
RMFDURw. Informat
Reads duration intervals of RMF records.
Categories: CAS
Date and Time
Syntax
RMFDURw.
Syntax Description
w
specifies the width of the input field.
Details
The RMFDURw. informat reads the duration of RMF measurement intervals of RMF
records that are produced as packed decimal data by IBM mainframe systems.
Then, the RMFDURw. informat converts the measurement intervals to SAS time
values.
The general form of the duration interval data in an RMF record in hexadecimal
notation is mmsstttF:
mm
is the 1-byte representation of two digits that correspond to minutes.
ss
is the 1-byte representation of two digits that correspond to seconds.
ttt
is the 1 1/2-byte representation of three digits that correspond to thousandths of
a second.
F
is a half byte that contains all binary 1s, which assigns the value as positive.
If the field does not contain packed decimal data, RMFDURw. results in a missing
value.
Comparisons
n Both the RMFDURw. informat and the RMFSTAMPw. informat read packed
decimal information from RMF records that are produced by IBM mainframe
systems.
n The RMFDURw. informat reads duration data and results in a time value.
Example
The variable is a hexadecimal representation of a binary duration value that is
stored in packed decimal form as it would appear in an RMF record. Each byte
occupies one column of the input field. The result is a SAS time value that
corresponds to 00:35:52.226.
data _null_;
a=input('3552226F'x,rmfdur4.);
put a=;
run;
SAS writes the following to the log:
a=2152.226
672 Chapter 4 / Dictionary of Informats
See Also
Informats:
n “RMFSTAMPw. Informat” on page 672
n “SMFSTAMPw. Informat” on page 697
RMFSTAMPw. Informat
Reads time and date fields of RMF records.
Categories: CAS
Date and Time
Syntax
RMFSTAMPw.
Syntax Description
w
specifies the width of the input field.
Details
The RMFSTAMPw. informat reads packed decimal time and date values of RMF
records that are produced by IBM mainframe systems. Then, the RMFSTAMPw.
informat converts the time and date values to SAS datetime values.
The general form of the time and date information in an RMF record in hexadecimal
notation is 0hhmmssFccyydddF:
0
is the half byte that contains all binary 0s.
hh
is the 1-byte representation of two digits that correspond to the hour of the day.
mm
is the 1-byte representation of two digits that correspond to minutes.
ss
is the 1-byte representation of two digits that correspond to seconds.
ROWw.d Informat 673
cc
is the 1-byte representation of two digits that correspond to the century.
yy
is the 1-byte representation of two digits that correspond to the year.
ddd
is the 1 1/2- bytes that contain three digits that correspond to the day of the year.
F
is the half byte that contains all binary 1s.
The century indicators 00 correspond to 1900, 01 to 2000, and 02 to 2100.
RMFSTAMPw. enables you to read, in any operating environment, packed decimal
time and date values from files that are created on an IBM mainframe.
Comparisons
Both the RMFSTAMPw. informat and the PDTIMEw. informat read packed decimal
values from RMF records. The RMFSTAMPw. informat reads both time and date
values and results in a SAS datetime value. The PDTIMEw. informat reads only time
values and results in a SAS time value.
Example
The variable is a hexadecimal representation of a binary time and date value that is
stored in packed decimal form as it would appear in an RMF record. Each byte
occupies one column of the input field. The result is a SAS datetime value that
corresponds to July 18, 2018, 2:22.25 PM.
data one;
input x $hex16.;
y=input(x,rmfstamp8.);
put y ;
put y datetime16.;
datalines;
0142225F2618200F
;
run;
SAS writes the following output to the log:
80739901345
18JUL18:14:22:25
ROWw.d Informat
Reads a column-binary field down a card column.
Category: Column Binary
674 Chapter 4 / Dictionary of Informats
Restriction: This informat is not supported in a DATA step that runs in CAS.
Syntax
ROWw.d
Syntax Description
w
specifies the row where the field begins.
Range 0–12
d
specifies the length in rows of the field.
Default 0
Range 0–25
Details
Column-binary data storage compresses data so that more than 80 items of data
can be stored on a single “virtual” punch card.
The ROWw.d informat assigns the relative position of the punch in the field to a
numeric variable.
If the field that you specify has more than one punch, ROWw.d assigns the variable
a missing value and sets the automatic variable _ERROR_ to 1. If the field has no
punches, ROWw.d assigns the variable a missing value.
ROWw.d can read fields across columns, continuing with row 12 of the new column
and going down through the rest of the rows. After ROWw.d reads a field, the
pointer moves to the next row.
Example
input x row5.3
input x row7.1
input x row5.2
input x row3.5
Variable1 Result
----+----1
00
S370FFw.d Informat 675
Variable1 Result
04 3
1 The variable is a hexadecimal representation of the column binary. The “virtual” punch card column
for the example data has row 7 punched. The binary representation is 0000 0000 0000 0100.
See Also
n “Description of Column-Binary Data Storage” in SAS Programmer’s Guide:
Essentials
Informats:
n “$CBw. Informat” on page 564
n “CBw.d Informat” on page 611
n “PUNCH.d Informat” on page 667
S370FFw.d Informat
Reads EBCDIC numeric data.
Categories: CAS
Numeric
Syntax
S370FFw.d
Syntax Description
w
specifies the width of the input field.
Default 12
Range 1–32
676 Chapter 4 / Dictionary of Informats
d
specifies the power of 10 by which to divide the value. This argument is optional.
Range 0–31
Details
The S370FFw.d informat reads numeric data that is represented in EBCDIC and
converts the data to native format. If EBCDIC is the native format, S370FFw.d
performs no conversion.
S370FFw.d reads EBCDIC numeric values that are represented with 1 byte per
digit. Use S370FFw.d in other operating environments to read numeric data from
IBM mainframe files.
S370FFw.d reads numeric values located anywhere in the input field. EBCDIC
blanks can precede or follow a numeric value with no effect. If a value is negative,
an EBCDIC minus sign should immediately precede the value. S370FFw.d reads
values with EBCDIC decimal points and values in scientific notation, and it interprets
a single EBCDIC period as a missing value.
Comparisons
The S370FFw.d informat performs the same role for numeric data that the
$EBCDICw.d informat does for character data. That is, on an IBM mainframe
system, S370FFw.d has the same effect as the standard w.d informat. On all other
systems, using S370FFw.d is equivalent to using $EBCDICw.d as well as using the
standard w.d informat.
Example
The variables are hexadecimal representations of codes for characters. Each two
hexadecimal characters correspond to 1 byte of binary data, and each byte
corresponds to one character value.
data _null_;
a=input('F1F2F3'x,s370ff3.);
b=input('F2F4F0'x,s370ff3.);
put a= b=;
run;
SAS writes the following to the log:
a=123 b=240
S370FIBw.d Informat 677
S370FIBw.d Informat
Reads integer binary (fixed-point) values, including negative values, in IBM mainframe format.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
Syntax
S370FIBw.d
Syntax Description
w
specifies the width of the input field.
Default 4
Range 1–8
d
specifies the power of 10 by which to divide the value. This argument is optional.
Range 0–10
Details
The S370FIBw.d informat reads integer binary (fixed-point) values that are stored in
IBM mainframe format, including negative values that are represented in two's-
complement notation. S370FIBw.d reads integer binary values with consistent
results if the values are created in the same type of operating environment that you
use to run SAS.
Use S370FIBw.d for integer binary data that is created in IBM mainframe format for
reading in other operating environments.
Comparisons
n If you use SAS on an IBM mainframe, S370FIBw.d and IBw.d are identical.
Example
You can use the INPUT statement and specify the S370FIB informat. However, this
example uses the informat with the INPUT function, where the binary input value is
described using a hexadecimal literal.
data _null_;
a=input('0080'x,s370fib2.);
put a=;
run;
SAS writes the following to the log:
a=128
See Also
Informats
n “S370FIBUw.d Informat” on page 678
n “S370FPIBw.d Informat” on page 683
S370FIBUw.d Informat
Reads unsigned integer binary (fixed-point) values in IBM mainframe format.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
S370FIBUw.d Informat 679
Syntax
S370FIBUw.d
Syntax Description
w
specifies the width of the input field.
Default 4
Range 1–8
d
specifies the power of 10 by which to divide the value. SAS uses the d value
even if the data contains decimal points. This argument is optional.
Range 0–10
Details
The S370FIBUw.d informat reads unsigned integer binary (fixed-point) values that
are stored in IBM mainframe format, including negative values that are represented
in two's-complement notation. Unsigned integer binary values are the same as
integer binary values, except that all values are treated as positive. S370FIBUw.d
reads integer binary values with consistent results if the values are created in the
same type of operating environment that you use to run SAS.
Use S370FIBUw.d for unsigned integer binary data that is created in IBM mainframe
format for reading in other operating environments.
Comparisons
n The S370FIBUw.d informat is equivalent to the COBOL notation PIC 9(n)
BINARY, where n is the number of digits.
n The S370FIBUw.d and S370FPIBw.d informats are identical.
Example
You can use the INPUT statement and specify the S370FIBU informat. However,
these examples use the informat with the INPUT function, where binary input values
are described using a hexadecimal literal.
data _null_;
result1=input('7F'x,s370fibu1.);
result2=input('F6'x,s370fibu1.);
put result1 +1 result2;
run;
See Also
Informats:
n “S370FIBw.d Informat” on page 677
n “S370FPIBw.d Informat” on page 683
S370FPDw.d Informat
Reads packed data in IBM mainframe format.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
Syntax
S370FPDw.d
S370FPDw.d Informat 681
Syntax Description
w
specifies the width of the input field.
Default 1
Range 1–16
d
specifies the power of 10 by which to divide the value. This argument is optional.
Default 0
Range 0–31
Details
Packed decimal data contains two digits per byte, but only one digit in the input field
represents the sign. The last half of the last byte indicates the sign: a C or an F for
positive numbers and a D for negative numbers.
Use S370FPDw.d to read packed decimal data from IBM mainframe files in other
operating environments.
Comparisons
n If you use SAS on an IBM mainframe, the S370FPDw.d and PDw.d informats
are identical.
n The following table compares the equivalent packed decimal notation by
programming language:
SAS S370FPD4.
assembler PL4
682 Chapter 4 / Dictionary of Informats
Example
The variable in this example is a hexadecimal representation of a binary number
that is stored in packed decimal form. Each two hexadecimal characters correspond
to 1 byte of binary data, and each byte corresponds to one column of the input field.
data _null_;
a=input('12345F'x,s370fpd3.);
put a=;
run;
SAS writes the following to the log:
a=12345
S370FPDUw.d Informat
Reads unsigned packed decimal data in IBM mainframe format.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
Syntax
S370FPDUw.d
Syntax Description
w
specifies the width of the input field.
Default 1
Range 1–16
d
specifies the power of 10 by which to divide the value. This argument is optional.
Default 0
Range 0–31
S370FPIBw.d Informat 683
Details
Packed decimal data contains two digits per byte. The last half of the last byte,
which indicates the sign for signed packed data, is always F for unsigned packed
data.
Use S370FPDUw.d in other operating environments to read unsigned packed
decimal data from IBM mainframe files.
Comparisons
n The S370FPDUw.d informat is similar to the S370FPDw.d informat, except that
the S370FPDUw.d informat rejects all sign digits except F.
n The S370FPDUw.d informat is equivalent to the COBOL notation PIC 9(n)
PACKED-DECIMAL, where n is the number of digits.
Example
input @1 x s370fpdu3.;
Variable1 Result
----+----1
12345F 12345
1 The variable is a hexadecimal representation of a binary number that is stored in packed decimal
form. Each two hexadecimal characters correspond to 1 byte of binary data, and each byte
corresponds to one column of the input field.
S370FPIBw.d Informat
Reads positive integer binary (fixed-point) values in IBM mainframe format.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
684 Chapter 4 / Dictionary of Informats
Syntax
S370FPIBw.d
Syntax Description
w
specifies the width of the input field.
Default 4
Range 1–8
d
specifies the power of 10 by which to divide the value. This argument is optional.
Default 0
Range 0–10
Details
Positive integer binary values are the same as integer binary values, except that all
values are treated as positive. S370FPIBw.d reads integer binary values with
consistent results if the values are created in the same type of operating
environment that you use to run SAS.
Use S370FPIBw.d for positive integer binary data that is created in IBM mainframe
format for reading in other operating environments.
Comparisons
n If you use SAS on an IBM mainframe, S370FPIBw.d and PIBw.d are identical.
Example
You can use the INPUT statement and specify the S370FPIB informat. However,
this example uses the informat with the INPUT function, where the binary input
value is described using a hexadecimal literal.
data _null_;
result=input('0100',s370fpib2.);
put result;
run;
See Also
Informats:
n “S370FIBw.d Informat” on page 677
n “S370FIBUw.d Informat” on page 678
S370FRBw.d Informat
Reads real binary (floating-point) data in IBM mainframe format.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
Syntax
S370FRBw.d
Syntax Description
w
specifies the width of the input field.
Default 4
Range 2–8
686 Chapter 4 / Dictionary of Informats
d
specifies the power of 10 by which to divide the value. This argument is optional.
Range 0–10
Details
Real binary values are represented in two parts: a mantissa that gives the value,
and an exponent that gives the value's magnitude.
Use S370FRBw.d to read real binary data from IBM mainframe files in other
operating environments.
Comparisons
n If you use SAS on an IBM mainframe, S370FRBw.d and RBw.d are identical.
n The following table shows the equivalent real binary notation for several
programming languages:
assembler E D
C float double
See Also
Informats:
n “RBw.d Informat” on page 668
S370FZDw.d Informat 687
S370FZDw.d Informat
Reads zoned decimal data in IBM mainframe format.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
Syntax
S370FZDw.d
Syntax Description
w
specifies the width of the input field.
Default 8
Range 1–32
d
specifies the power of 10 by which to divide the value. If the data contains
decimal points, the d value is ignored. This argument is optional.
Default 0
Range 0–31
Details
Zoned decimal data is similar to standard decimal data in that every digit requires 1
byte. However, the value's sign is stored in the last byte, along with the last digit.
Use S370FZDw.d in other operating environments to read zoned decimal data from
IBM mainframe files.
Comparisons
n If you use SAS on an IBM mainframe, S370FZDw.d and ZDw.d are identical.
688 Chapter 4 / Dictionary of Informats
n The following table shows the equivalent zoned decimal notation for several
programming languages:
SAS S370FZD3.
PL/I PICTURE'99T'
assembler ZL3
Example
The variable contains a hexadecimal representation of a binary number stored in
zoned decimal format in an IBM mainframe operating environment. Each two
hexadecimal characters correspond to 1 byte of binary data, and each byte
corresponds to one column of the input field.
data _null_;
a=input('F1F2C3'x,s370fzd3.);
b=input('F1F2D3'x,s370fzd3.);
put a= b=;
run;
SAS writes the following to the log:
a=123 b=-123
See Also
Informats:
n “ZDw.d Informat” on page 723
S370FZDBw.d Informat
Reads zoned decimal data in which 0s have been left blank.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
S370FZDBw.d Informat 689
Syntax
S370FZBDw.d
Syntax Description
w
specifies the width of the input field.
Default 8
Range 1–32
d
specifies the power of 10 by which to divide the value. This argument is optional.
Default 0
Range 0–31
Details
Use the S370FZDBw.d informat in other operating environments to read zoned
decimal data from IBM mainframe files.
Example
The variables contain a hexadecimal representation of a binary number that is
stored in zoned decimal format in an IBM mainframe operating environment. Two
hexadecimal characters correspond to 1 byte of binary data, and each byte
corresponds to one column of the input field.
data _null_;
a=input('40404040F14040C0'x,s370fzdb8.);
b=input('4040404040F1F2D3'x,s370fzdb8.);
put a= b=;
run;
SAS writes the following to the log:
a=1000 b=-123
690 Chapter 4 / Dictionary of Informats
S370FZDLw.d Informat
Reads zoned decimal leading-sign data in IBM mainframe format.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
Syntax
S370FZDLw.d
Syntax Description
w
specifies the width of the input field.
Default 8
Range 1–32
d
specifies the power of 10 by which to divide the value. This argument is optional.
Default 0
Range 0–31
Details
Use S370FZDLw.d in other operating environments to read zoned decimal data
from IBM mainframe files.
Comparisons
n Zoned decimal leading-sign data is similar to standard zoned decimal data,
except that the sign of the value is stored in the first byte of zoned decimal
leading-sign data, along with the first digit.
n The S370FZDLw.d informat is equivalent to the COBOL notation PIC S9(n)
DISPLAY SIGN LEADING, where n is the number of digits.
S370FZDSw.d Informat 691
Example
The variables contain a hexadecimal representation of a binary number stored in
zoned decimal format in an IBM mainframe operating environment. Each two
hexadecimal characters correspond to 1 byte of binary data, and each byte
corresponds to one column of the input field.
data _null_;
a=input('C1F2F3'x,s370fzdl3.);
b=input('D1F2F3'x,s370fzdl3.);
put a= b=;
run;
SAS writes the following to the log:
a=123 b=-123
S370FZDSw.d Informat
Reads zoned decimal, separate leading-sign data in IBM mainframe format.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
Syntax
S370FZDSw.d
Syntax Description
w
specifies the width of the input field.
Default 8
Range 2–32
d
specifies the power of 10 by which to divide the value. This argument is optional.
Default 0
Range 0–31
692 Chapter 4 / Dictionary of Informats
Details
Use S370FZDSw.d in other operating environments to read zoned decimal data
from IBM mainframe files.
Comparisons
n Zoned decimal, separate leading-sign data is similar to standard zoned decimal
data, except that the sign of the value is stored in the first byte of zoned decimal,
leading-sign data, and the first digit of the value is stored in the second byte.
n The S370FZDSw.d informat is equivalent to the COBOL notation PIC S9(n)
DISPLAY SIGN LEADING SEPARATE, where n is the number of digits.
Example
The variable contains a hexadecimal representation of a binary number that is
stored in zoned decimal format in an IBM mainframe operating environment. Each
two hexadecimal characters correspond to 1 byte of binary data, and each byte
corresponds to one column of the input field.
data _null_;
a=input('4EF1F2F3'x,s370fzds4.);
b=input('60F1F2F3'x,s370fzds4.);
put a= b=;
run;
SAS writes the following to the log:
a=123 b=-123
S370FZDTw.d Informat
Reads zoned decimal, separate trailing-sign data in IBM mainframe format.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
Syntax
S370FZDTw.d
S370FZDTw.d Informat 693
Syntax Description
w
specifies the width of the input field.
Default 8
Range 2–32
d
specifies the power of 10 by which to divide the value. This argument is optional.
Default 0
Range 0–31
Details
Use S370FZDTw.d in other operating environments to read zoned decimal data
from IBM mainframe files.
Comparisons
n Zoned decimal, separate trailing-sign data is similar to zoned decimal, separate
leading-sign data, except that the sign of the value is stored in the last byte of
zoned decimal, separate trailing-sign data.
n The S370FZDTw.d informat is equivalent to the COBOL notation PIC S9(n)
DISPLAY SIGN TRAILING SEPARATE, where n is the number of digits.
Example
The variable contains a hexadecimal representation of a binary number that is
stored in zoned decimal format in an IBM mainframe operating environment. Each
two hexadecimal characters correspond to 1 byte of binary data, and each byte
corresponds to one column of the input field.
data _null_;
a=input('F1F2F34E'x,s370fzdt4.);
b=input('F1F2F360'x,s370fzdt4.);
put a= b=;
run;
SAS writes the following to the log:
a=123 b=-123
694 Chapter 4 / Dictionary of Informats
S370FZDUw.d Informat
Reads unsigned zoned decimal data in IBM mainframe format.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
Syntax
S370FZDUw.d
Syntax Description
w
specifies the width of the input field.
Default 8
Range 1–32
d
specifies the power of 10 by which to divide the value. This argument is optional.
Default 0
Range 0–31
Details
Use S370FZDUw.d in other operating environments to read unsigned zoned
decimal data from IBM mainframe files.
Comparisons
n The S370FZDUw.d informat is similar to the S370FZDw.d informat, except that
the S370FZDUw.d informat rejects all sign digits except F.
n The S370FZDUw.d informat is equivalent to the COBOL notation PIC 9(n)
DISPLAY, where n is the number of digits.
SHRSTAMPw. Informat 695
Example
The variable contains a hexadecimal representation of a binary number that is
stored in zoned decimal format in an IBM mainframe operating environment. Each
two hexadecimal characters correspond to 1 byte of binary data, and each byte
corresponds to one column of the input field.
data _null_;
a=input('F1F2F3'x,s370fzdu3.);
put a=;
run;
SAS writes the following to the log:
a=123
SHRSTAMPw. Informat
Reads date and time values of SHR records.
Categories: CAS
Date and Time
Syntax
SHRSTAMPw.
Syntax Description
w
specifies the width of the input field.
Details
The SHRSTAMPw. informat reads packed decimal date and time values of SHR
records that are produced by IBM mainframe environments. Then, the
SHRSTAMPw. format converts the date and time values to SAS datetime values.
The general form of the date and time information in an SHR record in hexadecimal
notation is ccyydddFhhmmssth. The letters are defined as follows:
696 Chapter 4 / Dictionary of Informats
ccyy
is the 2-byte representation of the year. The cc portion is the 1-byte
representation of a two-digit integer that represents the century. The yy portion is
the 1-byte representation of two digits that correspond to the year.
The cc portion is the century indicator where 00 indicates 19yy, 01 indicates
20yy, 02 indicates 21yy, and so on. A hexadecimal year value of 0115 is equal to
the year 2015.
ddd
is the 1 1/2 bytes that contain three digits that correspond to the day of the year.
F
is the half-byte that contains all binary 1s.
hh
is the 1-byte representation of two digits that correspond to the hour of the day.
mm
is the 1-byte representation of two digits that correspond to minutes.
ss
is the 1-byte representation of two digits that correspond to seconds.
th
is the 1-byte representation of two digits that correspond to a 100th of a second.
The SHRSTAMPw. informat enables you to read, in any operation environment,
packed decimal date and time values from files that are created on an IBM
mainframe.
Example
data values;
shrstamp=input('0218239F12403576'x,shrstamp8.);
put shrstamp ;
put shrstamp datetime.;
run;
Variable1 Result
----+----1----+----2
1 The variable is a hexadecimal representation of a packed decimal date and time value that is stored
as it would appear in an SHR record. Each byte occupies one column of the input field. The result is
a SAS datetime value that corresponds to August 27, 2018 12:40:36.
SMFSTAMPw. Informat 697
SMFSTAMPw. Informat
Reads time and date values of SMF records.
Categories: CAS
Date and Time
Syntax
SMFSTAMPw.
Syntax Description
w
specifies the width of the input field.
Details
The SMFSTAMPw. informat reads integer binary time values and packed decimal
date values of SMF records that are produced by IBM mainframe systems. Then,
the SMFSTAMPw. informat converts the time and date values to SAS datetime
values.
The date portion of an SMF record in hexadecimal notation is ccyydddF.
cc
is the 1-byte representation of two digits that correspond to the century.
yy
is the 1-byte representation of two digits that correspond to the year.
ddd
is the 1 1/2 bytes that contain three digits that correspond to the day of the year.
F
is the half byte that contains all binary 1s.
The SMFSTAMPw. informat enables you to read, in any operating environment,
integer binary time values and packed decimal date values from files that are
created on an IBM mainframe.
698 Chapter 4 / Dictionary of Informats
Example
data one;
input x: $hex16.;
y=input(x,smfstamp8.);
put y;
put y datetime16.;
datalines;
0058DC0C0108200F
;
run;
Variable1 Result
----+----1----+----2
put y ; 1532016635
1 The variable is a hexadecimal representation of a binary time and date value that is stored as it
would appear in an SMF record. Each byte occupies one column of the input field. The result is a
SAS datetime value that corresponds to July 18, 2018, 4:10:35 PM.
STIMERw. Informat
Reads time values and determines whether the values are hours, minutes, or seconds; reads the output of
the STIMER system option.
Category: Time
Restriction: This informat is not supported in a DATA step that runs in CAS.
Syntax
STIMERw.
Syntax Description
w
specifies the width of the input field.
Default 10
Range 1–32
STIMERw. Informat 699
Details
The STIMER informat reads performance statistics that the STIMER system option
writes to the SAS log.
The informat reads time values and determines whether the values are hours,
minutes, or seconds based on the presence of decimal points and colons:
n If no colon is present, the value is the number of seconds.
n If a single colon is present, the value before the colon is the number of minutes.
The value after the colon is the number of seconds.
n If two colons are present, the sequence of time is hours, minutes, and then
seconds.
In all cases, the result is a SAS time value.
The input values for STIMER must be in one of these forms:
n ss
n ss.ss
n mm:ss
n mm:ss.ss
n hh:mm:ss
n hh:mm:ss.ss
ss
is an integer that represents the number of seconds.
mm
is an integer that represents the number of minutes.
hh
is an integer that represents the number of hours.
Example
data one;
input test stimer10.;
put test=;
datalines;
234
333.4444
1846989
83769.6
202
;
run;
SAS writes the following output to the log:
700 Chapter 4 / Dictionary of Informats
test=234
test=333.4444
test=1846989
test=83769.6
test=202
TIMEw. Informat
Reads hours, minutes, and seconds in the form hh:mm:ss.ss, where special characters such as the colon
(:) or the period (.) are used to separate the hours, minutes, and seconds.
Categories: CAS
Time
Syntax
TIMEw.
Syntax Description
w
specifies the width of the input field.
Default 8
Range 5–32
Details
The TIMEw. informat reads SAS time values in the form hh:mm:ss<.ss> <AM | PM>.
hh
is an integer that represents the number of hours.
:
represents a special character that separates hours, minutes, and seconds.
mm
is an integer between 00 and 59 that represents minutes.
ss<.ss>
is an integer that represents the number of seconds, and if needed, tenths of a
second. Seconds and tenths of a second must always be separated by a period.
AM | PM
AM indicates time between 12:00 midnight and 11:59 in the morning. PM
indicates time between 12:00 noon and 11:59 at night.
TIMEw. Informat 701
Separate hh, mm, and ss with a special character. When the period is used as the
special character, the time is interpreted in the order hours, minutes, and seconds.
For example, 23.22 is 23 hours and 22 minutes, not 23 minutes and 22 seconds, or
23 seconds and 22 tenths of a second.
If you do not enter a value for seconds, SAS assumes a value of 0.
The stored value is the total number of seconds in the time value.
You must specify a value in the hours field when using the TIME informat. You do
not have to specify a value in the hours field when using the STIMER informat.
Example
data test;
time='12:56';
sastime=input(time,time.);
put sastime ;
put sastime time8.;
run;
SAS writes the following output to the log:
46560
12:56:00
See Also
Formats:
n “HHMMw.d Format” on page 221
n “HOURw.d Format” on page 224
n “MMSSw.d Format” on page 240
n “TIMEw.d Format” on page 463
Functions:
n “HOUR Function” in SAS Functions and CALL Routines: Reference
n “MINUTE Function” in SAS Functions and CALL Routines: Reference
n “SECOND Function” in SAS Functions and CALL Routines: Reference
n “TIME Function” in SAS Functions and CALL Routines: Reference
Informats:
n “STIMERw. Informat”
702 Chapter 4 / Dictionary of Informats
TODSTAMPw. Informat
Reads an 8-byte time-of-day stamp.
Categories: CAS
Time
Syntax
TODSTAMPw.
Syntax Description
w
specifies the width of the input field.
Details
The TODSTAMPw. informat reads time-of-day clock values that are produced by
IBM mainframe operating systems and converts the clock values to SAS datetime
values.
If the time-of-day value is all 0s, TODSTAMPw. results in a missing value.
Use TODSTAMPw. in other operating environments to read time-of-day values that
are produced by an IBM mainframe.
Example
This example uses a SAS datetime value that corresponds to September 9, 2018,
11:59:58.
data one;
date='D4E7F43876B80000'x;
dt2=input(date,todstamp8.);
put dt2 /
dt2 datetime20.;
run;
SAS writes the following output to the log:
TRAILSGNw. Informat 703
1852113598
09SEP2018:11:59:58
TRAILSGNw. Informat
Reads a trailing plus (+) or minus (–) sign.
Category: Numeric
Restriction: This informat is not supported in a DATA step that runs in CAS.
Syntax
TRAILSGNw.
Syntax Description
w
specifies the width of the input field.
Default 6
Range 1–32
Details
If the data contains a decimal point, the TRAILSGN informat honors the number of
decimal places that are in the input data. If the data contains a comma, the
TRAILSGN informat reads the value, ignoring the comma.
Example
data _null_;
a=input('1',trailsgn8.);
b=input('1,000',trailsgn8.);
c=input('1+',trailsgn8.);
d=input('1-',trailsgn8.);
e=input('1.2',trailsgn8.);
f=input('1.2+',trailsgn8.);
g=input('1.2-',trailsgn8.);
put a= b= c= d= e= f= g=;
run;
SAS writes the following output to the log:
704 Chapter 4 / Dictionary of Informats
TUw. Informat
Reads timer units.
Categories: CAS
Time
Syntax
TUw.
Syntax Description
w
specifies the width of the input field.
Details
The TUw. informat reads timer unit values that are produced by IBM mainframe
operating environments and converts the timer unit values to SAS time values.
There are exactly 38,400 software timer units per second. The low-order bit in a
timer unit value represents approximately 26.041667 microseconds.
Use the TUw. informat to read timer unit values that are produced by an IBM
mainframe in other operating environments.
Example
The variable is a hexadecimal representation of a binary, 4-byte timer unit value.
Each byte occupies one column of the input field. The result is a SAS time value
that corresponds to 5:26:58.41 p.m.
data _null_;
a=input('8FC7A9BC'x,tu4.);
put a=;
run;
SAS writes the following to the log:
VAXRBw.d Informat 705
a=62818.411563
VAXRBw.d Informat
Reads real binary (floating-point) data in VMS format.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
Syntax
VAXRBw.d
Syntax Description
w
specifies the width of the input field.
Default 4
Range 2–8
d
specifies the power of 10 by which to divide the value. This argument is optional.
Range 0–10
Details
Use the VAXRBw.d informat to read floating-point data from VMS files in other
operating environments.
Comparisons
If you use SAS that is running under VMS, the VAXRBw.d and the RBw.d informats
are identical.
706 Chapter 4 / Dictionary of Informats
See Also
Informats:
n “RBw.d Informat” on page 668
VMSZNw.d Informat
Reads VMS and MicroFocus COBOL zoned numeric data.
Categories: CAS
Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
Syntax
VMSZNw.d
Syntax Description
w
specifies the width of the output field.
Default 1
Range 1–32
d
specifies the number of digits to the right of the decimal point in the numeric
value. This argument is optional.
Details
The VMSZNw.d informat is similar to the ZDw.d informat. Both read a string of
ASCII digits, and the last digit is a special character denoting the magnitude of the
last digit and the sign of the entire number. The difference between the VMSZNw.d
informat and the ZDw.d informat is in the special character used for the last digit.
The following table shows the special characters used by the VMSZNw.d informat.
VMSZNw.d Informat 707
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 w
8 8 –8 x
9 9 –9 y
Example
data _null_;
a=input('1234',vmszn4.);
b=input('123t',vmszn4.);
put a= b=;
run;
SAS writes the following to the log:
a=1234 b=-1234
See Also
Formats:
n “VMSZNw.d Format” on page 472
Informats:
n “ZDw.d Informat” on page 723
708 Chapter 4 / Dictionary of Informats
w.d Informat
Reads standard numeric data.
Categories: CAS
Numeric
Alias: BESTw.d, Dw.d, Ew.d, Fw.d
Syntax
w.d
Syntax Description
w
specifies the width of the input field.
Range 1–32
d
specifies the power of 10 by which to divide the value. If the data contains
decimal points, the d value is ignored. This argument is optional.
Range 0–31
Details
The w.d informat reads numeric values that are located anywhere in the field.
Blanks can precede or follow a numeric value with no effect. A minus sign with no
separating blank should immediately precede a negative value. The w.d informat
reads values with decimal points and values in scientific E notation, and it interprets
a single period as a missing value.
Comparisons
n The w.d informat is identical to the BZw.d informat, except that the w.d informat
ignores trailing blanks in the numeric values. To read trailing blanks as 0s, use
the BZw.d informat.
n The w.d informat can read values in scientific E notation exactly as the Ew.d
informat does.
WEEKUw. Informat 709
Example
data test;
value='123.456';
value2=input(value,8.3);
put value2 ;
run;
SAS writes the following output to the log:
123.456
WEEKUw. Informat
Reads a value in the form of a week number within the year and returns a SAS date value by using the U
algorithm.
Category: Date
Restriction: This informat is not supported in a DATA step that runs in CAS.
Syntax
WEEKUw.
Syntax Description
w
specifies the width of the input field.
Default 11
Range 3–200
Details
The WEEKUw. informat reads the week-number value within the year, and then
returns a SAS date value by using the U algorithm. If the input does not contain a
year expression, then WEEKUw. uses the current year as the year expression,
which is the default. If the input does not contain a day expression, then WEEKUw.
uses the first day of the week as the day expression, which is the default.
The U algorithm calculates the SAS date value by using the number-of-week value
within the year. (Sunday is considered the first day of the week.) The number-of-
week value is represented as a decimal number in the range 0–53, with a leading 0
710 Chapter 4 / Dictionary of Informats
and maximum value of 53. For example, the fifth week of the year would be
represented as 05.
The inputs to the WEEKUw. informat are the same date for the following example.
The current year is 2018.
Comparisons
The WEEKUw. informat reads the week-number value as a decimal number in the
range 0–53, with Sunday as the first day of the week.
The WEEKVw. informat reads the number-of-week value as a decimal number in
the range 01–53, with Monday as the first day of the week. Week one of the year is
the week that includes both January fourth and the first Thursday of the year. If the
first Monday of January is the second, third, or fourth, the preceding days are part of
the last week of the preceding year.
The WEEKWw. informat reads the week-number value as a decimal number in the
range 00–53, with Monday as the first day of the week.
Example
The current year is 2018 in these examples.
data one;
v=input('W01',weeku3.);
w=input('18W01',weeku5.);
x=input('18W0101',weeku7.);
y=input('2018W0101',weeku9.);
z=input('2018-W01-01',weeku11.);
put v;
put w;
put x;
put y;
put z;
run;
WEEKVw. Informat 711
Statement Result
----+----1
put v; 21555
put w; 21191
put x; 21191
put y; 21191
put z; 21191
See Also
Formats:
n “WEEKUw. Format” on page 481
n “WEEKVw. Format” on page 483
n “WEEKWw. Format” on page 485
Functions:
n “WEEK Function” in SAS Functions and CALL Routines: Reference
Informats:
n “WEEKVw. Informat” on page 711
n “WEEKWw. Informat” on page 714
WEEKVw. Informat
Reads a value in the form of a week number within a year and returns a SAS date value by using the V
algorithm.
Category: Date
Restriction: This informat is not supported in a DATA step that runs in CAS.
Syntax
WEEKVw.
712 Chapter 4 / Dictionary of Informats
Syntax Description
w
specifies the width of the input field.
Default 11
Range 3–200
Details
The WEEKVw. informat reads the week-number value within a year. If the input
does not contain a year expression, WEEKVw. uses the current year as the year
expression, which is the default. If the input does not contain a day expression,
WEEKVw. uses the first day of the week as the day expression, which is the default.
The V algorithm calculates the SAS date value. The number-of-week value is
represented as a decimal number in the range 01–53, with a leading 0 and a
maximum value of 53. Weeks begin on a Monday, and week 1 of the year is the
week that includes January 4 and the first Thursday of the year. If the first Monday
of January is 2, 3, or 4, the preceding days are part of the last week of the preceding
year. For example, the fifth week of the year would be represented as 06.
The inputs to the WEEKVw. informat are the same date for the following example.
The current year is 2018.
Comparisons
The WEEKVw. informat reads the week-number value as a decimal number in the
range 01–53, with Monday as the first day of the week. Week 1 of the year is the
week that includes January 4 and the first Thursday of the year. If the first Monday
of January is 2, 3, or 4, the preceding days are part of the last week of the preceding
year.
The WEEKUw. informat reads the week-number value as a decimal number in the
range 0–53, with Sunday as the first day of the week.
WEEKVw. Informat 713
Example
The current year is 2018 in these examples.
data one;
v=input('W01',weekv3.);
w=input('18W01',weekv5.);
x=input('18W0101',weekv7.);
y=input('2018W0101',weekv9.);
z=input('2018-W01-01',weekv11.);
put v;
put w;
put x;
put y;
put z;
run;
Statement Result
----+----1
put v; 21549
put w; 21185
put x; 21185
put y; 21185
put z; 21185
See Also
Formats:
n “WEEKUw. Format” on page 481
n “WEEKVw. Format” on page 483
n “WEEKWw. Format” on page 485
Functions:
n “WEEK Function” in SAS Functions and CALL Routines: Reference
Informats:
n “WEEKUw. Informat” on page 709
714 Chapter 4 / Dictionary of Informats
WEEKWw. Informat
Reads a value in the form of a week number within the year and returns a SAS date value by using the W
algorithm.
Category: Date
Restriction: This informat is not supported in a DATA step that runs in CAS.
Syntax
WEEKWw.
Syntax Description
w
specifies the width of the input field.
Default 11
Range 3–200
Details
The WEEKWw. informat reads the week-number value within the year. If the input
does not contain a year expression, the WEEKWw. informat uses the current year
as the year expression, which is the default. If the input does not contain a day
expression, the WEEKWw. informat uses the first day of the week as the day
expression, which is the default. The W algorithm calculates the SAS date value by
using the number of the week within the year. (Monday is considered the first day of
the week.) The number-of-week value is represented as a decimal number in the
range 0–53, with a leading 0 and maximum value of 53. For example, the fifth week
of the year would be represented as 05.
The inputs to the WEEKWw. informat are the same date for the following example.
The current year is 2018.
Comparisons
The WEEKWw. informat reads the week-number value as a decimal number in the
range 00–53, with Monday as the first day of the week.
The WEEKUw. informat reads the week-number value as a decimal number in the
range 00–53, with Sunday as the first day of the week.
The WEEKVw. informat reads the week-number value as a decimal number in the
range 01–53, with Monday as the first day of the week. Week one of the year is the
week that includes both January fourth and the first Thursday of the year. If the first
Monday of January is the second, third, or fourth, the preceding days are part of the
last week of the preceding year.
Example
The current year is 2018 in these examples.
data one;
v=input('W01',weekw3.);
w=input('18W01',weekw5.);
x=input('18W0101',weekw7.);
y=input('2018W0101',weekw9.);
z=input('2018-W01-01',weekw11.);
put v;
put w;
put x;
put y;
put z;
run;
Statement Result
----+----1
put v; 21556
put w; 21185
put x; 21185
put y; 21185
716 Chapter 4 / Dictionary of Informats
Statement Result
put z; 21185
See Also
Formats:
n “WEEKUw. Format” on page 481
n “WEEKVw. Format” on page 483
n “WEEKWw. Format” on page 485
Function:
n “WEEK Function” in SAS Functions and CALL Routines: Reference
Informats:
n “WEEKUw. Informat” on page 709
n “WEEKVw. Informat” on page 711
YMDDTTMw.d Informat
Reads datetime values in the form <yy>yy-mm-dd hh:mm:ss.ss, where special characters such as a
hyphen (-), period (.), slash (/), or colon (:) are used to separate the year, month, day, hour, minute, and
seconds. The year can be either two or four digits.
Category: Date and Time
Alignment: Right
Restriction: This informat is not supported in a DATA step that runs in CAS.
Syntax
YMDDTTMw.d
Syntax Description
w
specifies the width of the output field.
Default 19
Range 13−40
YMDDTTMw.d Informat 717
d
specifies the number of digits to the right of the decimal point in the seconds
value. The digits to the right of the decimal point specify a fraction of a second.
This argument is optional.
Default 0
Range 0−39
Details
The YMDDTTMw.d format reads SAS datetime values in the form <yy>yy-mm-dd
hh:mm:<ss<.ss>>:
yy or yyyy
specifies a two- or four-digit integer that represents the year.
mm
is an integer between 01 and 12 that represents the month.
dd
is an integer between 01 and 31 that represents the day of the month.
hh
is an integer between 00 and 23 that represents hours.
mm
is an integer between 00 and 59 that represents minutes.
ss.ss
is the number of seconds ranging from 00–59 with the fraction of a second
following the decimal point.
- or :
represents one of several special characters such as the slash (/), hyphen (-),
colon (:), or a blank character that can be used to separate date and time
components. Special characters can be used as separators between any date or
time component and between the date and the time.
Comparisons
The YMDDTTMw.d informat reads datetime values with required separators in the
form <yy>yy-mm-dd/hh:mm:ss.ss.
The MDYAMPMw.d informat reads datetime values with optional separators in the
form mm-dd-yy<yy> hh:mm:ss.ss AM | PM, and requires a space between the date
and the time.
718 Chapter 4 / Dictionary of Informats
The DATETIMEw.d informat reads datetime values with optional separators in the
form dd-mmm-yy<yy> hh:mm:ss.ss AM | PM, and the date and time can be
separated by a special character.
Example
data one;
input dt ymddttm24.;
put dt;
put dt datetime24.;
datalines;
2018-03-16 11:23:07.4
2018 03 16 11 23 07.4
18.3.16/11:23
run;
SAS writes the following output to the log:
1836818587.4
16MAR2018:11:23:07
1836818587.4
16MAR2018:11:23:07
1836818580
16MAR2018:11:23:00
See Also
Informats:
n “DATETIMEw. Informat” on page 616
n “MDYAMPMw.d Informat” on page 645
YYMMDDw. Informat
Reads date values in the form yymmdd or yyyymmdd.
Categories: CAS
Date
Syntax
YYMMDDw.
YYMMDDw. Informat 719
Syntax Description
w
specifies the width of the input field.
Default 6
Range 6–32
Details
SAS read date values in one of these forms:
n yymmdd
n yyyymmdd
yy or yyyy
is a two-digit or four-digit integer that represents the year.
mm
is an integer between 01 and 12 that represents the month of the year.
dd
is an integer between 01 and 31 that represents the day of the month.
You can separate the year, month, and day values by blanks or special characters.
However, if delimiters are used, place them between all the values. You can also
place blanks before and after the date. Make sure the width of the input field allows
space for blanks and special characters.
Note: SAS interprets a two-digit year as part of the 100-year span that is defined by
the YEARCUTOFF= system option.
Example
data test;
date='2018/05/04';
sasdate=input(date,yymmdd10.);
put sasdate;
put sasdate date9.;
run;
SAS writes the following output to the log:
21308
04MAY2018
720 Chapter 4 / Dictionary of Informats
See Also
Formats:
n “DATEw. Format” on page 169
n “DDMMYYw. Format” on page 175
n “MMDDYYw. Format” on page 235
n “YYMMDDw. Format” on page 496
Functions:
n “DAY Function” in SAS Functions and CALL Routines: Reference
n “MDY Function” in SAS Functions and CALL Routines: Reference
n “MONTH Function” in SAS Functions and CALL Routines: Reference
n “YEAR Function” in SAS Functions and CALL Routines: Reference
Informats:
n “DATEw. Informat” on page 615
n “DDMMYYw. Informat” on page 619
n “MMDDYYw. Informat” on page 647
System Options:
n “YEARCUTOFF= System Option” in SAS System Options: Reference
YYMMNw. Informat
Reads date values in the form yyyymm or yymm.
Categories: CAS
Date
Syntax
YYMMNw.
Syntax Description
w
specifies the width of the input field.
Default 6
Range 4–32
YYMMNw. Informat 721
Details
SAS reads date values in one of these forms:
n yyyymm
n yymm
yy or yyyy
is a two-digit or four-digit integer that represents the year.
mm
is a two-digit integer that represents the month.
The N in the informat name must be used and indicates that you cannot separate
the year and month values by blanks or special characters. SAS automatically adds
a day value of 01 to the value to make a valid SAS date variable.
Note: SAS interprets a two-digit year as part of the 100-year span that is defined by
the YEARCUTOFF= system option.
Example
data test;
date='201805';
sasdate=input(date,yymmn6.);
put sasdate;
put sasdate date9.;
run;
SAS writes the following output to the log:
21305
01MAY2018
See Also
Formats:
n “DATEw. Format” on page 169
n “DDMMYYw. Format” on page 175
n “YYMMDDw. Format” on page 496
n “YYMMw. Format” on page 495
n “YYMONw. Format” on page 503
Functions:
n “DAY Function” in SAS Functions and CALL Routines: Reference
n “MONTH Function” in SAS Functions and CALL Routines: Reference
722 Chapter 4 / Dictionary of Informats
Informats:
n “DATEw. Informat” on page 615
n “DDMMYYw. Informat” on page 619
n “MMDDYYw. Informat” on page 647
n “YYMMDDw. Informat” on page 718
System Options:
n “YEARCUTOFF= System Option” in SAS System Options: Reference
YYQw. Informat
Reads quarters of the year in the form yyQq or yyyyQq.
Categories: Date
CAS
Syntax
YYQw.
Syntax Description
w
specifies the width of the input field.
Details
SAS reads data in one of these forms:
n yyQq
n yyyyQq
yy or yyyy
is an integer that represents the two-digit or four-digit year.
ZDw.d Informat 723
q
is an integer (1, 2, 3, or 4) that represents the quarter of the year. You can also
represent the quarter as 01, 02, 03, or 04.
The letter Q must separate the year value and the quarter value. The year value, the
letter Q, and the quarter value cannot be separated by blanks. A value that is read
with YYQw. produces a SAS date value that corresponds to the first day of the
specified quarter.
Note: SAS interprets a two-digit year as part of the 100-year span that is defined by
the YEARCUTOFF= system option.
Example
data test;
date='2018Q2';
sasdate=input(date,yyq6.);
put sasdate;
put sasdate date9.;
run;
SAS writes the following output to the log:
21275
01APR2018
See Also
Functions:
n “QTR Function” in SAS Functions and CALL Routines: Reference
n “YEAR Function” in SAS Functions and CALL Routines: Reference
n “YYQ Function” in SAS Functions and CALL Routines: Reference
System Options:
n “YEARCUTOFF= System Option” in SAS System Options: Reference
ZDw.d Informat
Reads zoned decimal data.
Categories: CAS
Numeric
724 Chapter 4 / Dictionary of Informats
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
See: “ZD Informat: UNIX” in SAS Companion for UNIX Environments
“ZDw.d Informat: Windows” in SAS Companion for Windows
“ZDw.d Format: z/OS” in SAS Companion for z/OS
Syntax
ZDw.d
Syntax Description
w
specifies the width of the input field.
Default 1
Range 1–32
d
specifies the power of 10 by which to divide the value. This argument is optional.
Range 1–31
Details
The ZDw.d informat reads zoned decimal data in which every digit requires 1 byte
and in which the last byte contains the value's sign along with the last digit.
You can enter positive values in zoned decimal format from a personal computer.
Some keying devices enable you to enter negative values by overstriking the last
digit with a minus sign.
Comparisons
n Like the w.d informat, the ZDw.d informat reads data in which every digit
requires 1 byte. Use ZDVw.d or ZDw.d to read zoned decimal data in which the
last byte contains the last digit and the sign.
ZDBw.d Informat 725
n The ZDw.d informat functions like the ZDVw.d informat, with one exception:
ZDVw.d validates the input string and disallows invalid data.
n The following table compares the zoned decimal informat with notation in several
programming languages:
SAS ZD3.
PL/I PICTURE'99T'
Example
data _null_;
a=input('123{', zd4.);
put a=;
run;
SAS writes the following to the log:
a=1230
See Also
Informats
n “w.d Informat” on page 708
n “ZDVw.d Informat” on page 726
ZDBw.d Informat
Reads zoned decimal data in which zeros have been left blank.
Category: Numeric
Restriction: This informat is not supported in a DATA step that runs in CAS.
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
See: “ZDBw.d Informat: z/OS” in SAS Companion for z/OS
726 Chapter 4 / Dictionary of Informats
Syntax
ZDBw.d
Syntax Description
w
specifies the width of the input field.
Default 1
Range 1–32
d
specifies the power of 10 by which to divide the value. This argument is optional.
Range 0–31
Details
The ZDBw.d informat reads zoned decimal data that is produced in IBM 1410, 1401,
and 1620 form, where 0s are left blank rather than being punched.
Example
data _null_;
a=input('123{', zdb4.);
put a=;
run;
SAS writes the following output to the log:
a=1230
ZDVw.d Informat
Reads and validates zoned decimal data.
Category: Numeric
Restrictions: This informat is not supported in a DATA step that runs in CAS.
This option does not perform validation on z/OS.
Interaction: List input is incompatible with binary input when this informat is specified in an
INFORMAT= statement or an ATTRIB= statement that uses the INFORMAT= argument.
SAS issues a warning and uses formatted input to read the data.
ZDVw.d Informat 727
Syntax
ZDVw.d
Syntax Description
w
specifies the width of the input field.
Default 1
Range 1–32
d
specifies the power of 10 by which to divide the value. This argument is optional.
Range 1–31
Details
The ZDVw.d informat reads data in which every digit requires 1 byte and in which
the last byte contains the value's sign along with the last digit. It also validates the
input string and disallows invalid data.
ZDVw.d is dependent on the operating environment. For example, on IBM
mainframes, the ZDVw.d informat requires an F for all high-order nibbles except the
last. (In contrast, the ZDw.d informat ignores the high-order nibbles for all bytes
except for the nibbles that are associated with the sign.) The last high-order nibble
accepts values that range from A–F, where A, C, E, and F are positive values and B
and D are negative values. The low-order nibble on IBM mainframes must be a
numeric digit that ranges from 0–9, as with ZD.
Comparisons
The ZDVw.d informat functions like the ZDw.d informat, with one exception: ZDVw.d
validates the input string and disallows invalid data.
Example
data _null_;
a=input('123{', zdv4.);
728 Chapter 4 / Dictionary of Informats
b=input('123}', zdv4.);
put a= b=;
run;
SAS write the following to the log:
a=1230 b=-1230
See Also
Informats:
n “w.d Informat” on page 708
n “ZDw.d Informat” on page 723