Converts native format character data to ASCII representation
Category: Character
Alignment: left
$ASCII w .
w
specifies the width of the output field.
Default: 1
Range: 1 “32767
If ASCII is the native format, no conversion occurs.
On EBCDIC systems, $ASCII w . converts EBCDIC character data to ASCII w .
On all other systems, $ASCII w . behaves like the $CHAR w . format.
put x $ascii3.;
When x = ... | The Result [*] is ... |
---|---|
abc | 616263 |
ABC | 414243 |
(); | 28293B |
[*] The results are hexadecimal representations of ASCII codes for characters . Each two hexadecimal digits correspond to one byte of binary data, and each byte corresponds to one character. |
Convert a Logical ordered string to a Visually ordered string, and vice versa by reversing the order of Hebrew characters while preserving the order of Latin characters and numbers
Category: Character
Alignment: left
See: The BIDI format in SAS National Language Support (NLS): User s Guide
Converts character data to binary representation
Category: Character
Alignment: left
$BINARY w.
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
The $BINARY w . format converts character values to binary representation. The BINARY w . format converts numeric values to binary representation.
put @1 name $binary16.;
When name = ... | The Result is ... | |
---|---|---|
ASCII | EBCDIC | |
----+----1----+----2 | ----+----1----+----2 | |
AB | 0100000101000010 | 1100000111000010 |
Writes standard character data
Category: Character
Alignment: left
$CHAR w.
w
specifies the width of the output field.
Default: 8 if the length of variable is undefined ; otherwise , the length of the variable
Range: 1 “32767
The $CHAR w . format is identical to the $ w. format.
The $CHAR w . and $ w. formats do not trim leading blanks. To trim leading blanks, use the LEFT function to left align character data prior to output, or use the PUT statement with the colon (:) format modifier and the format of your choice to produce list output.
Use the following table to compare the SAS format $CHAR8. with notation in other programming languages:
Language | Notation |
---|---|
SAS | $CHAR8. |
C | char [8] |
COBOL | PIC x(8) |
FORTRAN | A8 |
PL/I | A(8) |
put @7 name $char4.;
When name = ... | The Result is ... |
---|---|
XYZ | ----+----1 XYZ |
Writes a character string in Hebrew text that is encoded in IBM-PC (cp862) to Windows Hebrew encoding (cp1255)
Category: Hebrew text handling
Alignment: left
See: The $CPTDW format in SAS National Language Support (NLS): User s Guide
Writes a character string that is encoded in Windows (cp1255) to Hebrew DOS (cp862) encoding
Category: Hebrew text handling
Alignment: left
See: The $CPTWD format in SAS National Language Support (NLS): User s Guide
Converts native format character data to EBCDIC representation
Category: Character
Alignment: left
$EBCDIC w.
w
specifies the width of the output field.
Default: 1
Range: 1 “32767
If EBCDIC is the native format, no conversion occurs.
On ASCII systems, $EBCDIC w . converts ASCII character data to EBCDIC.
On all other systems, $EBCDIC w . behaves like the $CHAR w . format.
put name $ebcdic3.;
When name = ... | The Result [*] is ... |
---|---|
qrs | 9899A2 |
QRS | D8D9E2 |
+; > | 4E5E6E |
[*] The results are shown as hexadecimal representations of EBCDIC codes for characters. Each two hexadecimal digits correspond to one byte of binary data, and each byte corresponds toone character. |
Converts character data to hexadecimal representation
Category: Character
Alignment: left
See: $HEX w . Format in the documentation for your operating environment.
$HEX w.
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
Tip: 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.
Tip: If w is greater than twice the length of the variable that you want to represent, $HEX w . pads it with blanks.
The $HEX w . format converts each character into two hexadecimal digits. Each blank counts as one character, including trailing blanks.
The HEX w . format converts real binary numbers to their hexadecimal equivalent.
put @5 name $hex4.;
When name = ... | The Result is ... | |
---|---|---|
EBCDIC | ASCII | |
AB | ----+----1 C1C2 | ----+----1 4142 |
Adds shift-code data to DBCS data
Category: DBCS
Alignment: left
See: The $KANJI format in SAS National Language Support (NLS): User s Guide
Removes shift code data from DBCS data
Category: DBCS
Alignment: left
See: The $KANJIX format in SAS National Language Support (NLS): User s Guide
Writes a character string in left-to-right logical order to visual order
Category: BIDI text handling
Alignment: left
See: The $LOGVS format in SAS National Language Support (NLS): User s Guide
Writes a character string in right-to-left logical order to visual order
Category: BIDI text handling
Alignment: left
See: The $LOGVSR format in SAS National Language Support (NLS): User s Guide
Writes character data in uppercase when the MSGCASE system option is in effect
Category: Character
Alignment: left
$MSGCASE w.
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
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.
Operating Environment Information: For more information about the MSGCASE= system option, see the SAS documentation for your operating environment.
put name $msgcase.;
When name = ... | The Result is ... |
---|---|
sas | SAS |
Converts character data to octal representation
Category: Character
Alignment: left
$OCTAL w.
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
Tip: Because each character value generates three octal characters, increase the value of w by three times the length of the character value.
The $OCTAL w . format converts character values to the octal representation of their character codes. The OCTAL w . format converts numeric values to octal representation.
The following example shows ASCII output when you use the $OCTAL w . format.
data _null_; infile datalines truncover; input item .; put item $octal15.; datalines; art rice bank ; run;
SAS writes the following results to the log.
141162164040040 162151143145040 142141156153040
Writes data values that are enclosed in double quotation marks
Category: Character
Alignment: left
$QUOTE w.
w
specifies the width of the output field.
Default: 8 if the length of the variable is undefined ; otherwise, the length of the variable + 2
Range: 2 “32767
Tip: Make w wide enough to include the left and right quotation marks.
The following list describes the output that SAS produces when you use the $QUOTE w . format. For examples of these items, see Examples on page 102.
If your data value is not enclosed in quotation marks, SAS encloses the output in double quotation marks.
If your data value is not enclosed in quotation marks, but the value contains a single quotation mark, SAS
encloses the data value in double quotation marks
does not change the single quotation mark.
If your data value begins and ends with single quotation marks, and the value contains double quotation marks, SAS
encloses the data value in double quotation marks
duplicates the double quotation marks that are found in the data value
does not change the single quotation marks.
If your data value begins and ends with single quotation marks, and the value contains two single contiguous quotation marks, SAS
encloses the value in double quotation marks
does not change the single quotation marks.
If your data value begins and ends with single quotation marks, and contains both double quotation marks and single, contiguous quotation marks, SAS
encloses the value in double quotation marks
duplicates the double quotation marks that are found in the data value
does not change the single quotation marks.
If the length of the target field is not large enough to contain the string and its quotation marks, SAS returns all blanks.
put name $quote20.;
When name = ... | The Result is ... |
---|---|
SAS SAS's 'ad"verb"' 'ad''verb' '"ad"''"verb"' deoxyribonucleotide | ----+----1 "SAS" "SAS's" "'ad""verb""'" "'ad''verb'" "'""ad""''""verb""'" |
Writes character data in reverse order and preserves blanks
Category: Character
Alignment: right
$REVERJ w .
w
specifies the width of the output field.
Default: 1 if w is not specified
Range: 1 “32767
The $REVERJ w . format is similar to the $REVERS w . format except that $REVERS w . left aligns the result by trimming all leading blanks.
put @1 name $reverj7.;
When name [*] = ... | The Result is ... |
---|---|
ABCD### ###ABCD | ----+----1 DCBA DCBA |
[*] The character # represents a blank space. |
Writes character data in reverse order and left aligns
Category: Character
Alignment: left
$REVERS w .
w
specifies the width of the output field.
Default: 1 if w is not specified
Range: 1 “32767
The $REVERS w . format is similar to the $REVERJ w . format except that $REVERJ w . does not left align the result.
put @1 name $revers7.;
When name [*] = ... | The Result is ... |
---|---|
----+----1 | |
ABCD### | DCBA |
###ABCD | DCBA |
[*] The character # represents a blank space. |
Writes a character string in big-endian, 16-bit, universal character set code in 2 octets (UCS2), Unicode encoding
Category: Character
Alignment: Left
See: The $UCS2B format in SAS National Language Support (NLS): User s Guide
Writes a big-endian, 16 “bit, universal character set code in 2 octets (UCS2) character string in the encoding of the current SAS session
Category: Character
Alignment: left
See: The $UCS2BE format in SAS National Language Support (NLS): User s Guide
Writes data in little-endian, 16-bit, universal character set code in 2 octets (UCS2), Unicode encoding
Category: Character
Alignment: Left
See: The $UCS2L format in SAS National Language Support (NLS): User s Guide
Writes a character string that is encoded in little-endian, 16-bit, universal character set code in 2 octets (UCS2), in the encoding of the current SAS session
Category: Character
Alignment: left
See: The $UCS2LE format in SAS National Language Support (NLS): User s Guide
Writes a character string in native-endian, 16-bit, universal character set code in 2 octets (UCS2) Unicode encoding
Category: Character
Alignment: Left
See: The $UCS2X format in SAS National Language Support (NLS): User s Guide
Writes a native-endian, 16-bit, universal character set code in 2 octets (UCS2) character string in the encoding of the current SAS session
Category: Character
Alignment: left
See: The $UCS2XE format in SAS National Language Support (NLS): User s Guide
Writes a character string in big-endian, 32-bit, universal character set code in 4 octets (UCS4), Unicode encoding
Category: Character
Alignment: Left
See: The $UCS4B format in SAS National Language Support (NLS): User s Guide
Writes a big-endian, 32-bit, universal character set code in 4 octets (UCS4), character string in the encoding of the current SAS session
Category: Character
Alignment: left
See: The $UCS4BE format in SAS National Language Support (NLS): User s Guide
Writes a character string in little-endian, 32-bit, universal character set code in 4 octets, (UCS4), Unicode encoding
Category: Character
Alignment: left
See: The $UCS4L format in SAS National Language Support (NLS): User s Guide
Writes a little-endian, 32-bit, universal character set code in 4 octets (UCS4) character string in the encoding of the current SAS session
Category: Character
Alignment: left
See: The $UCS4LE format in SAS National Language Support (NLS): User s Guide
Writes a character string in native-endian, 32-bit, universal character set code in 4 octets (UCS4), Unicode encoding
Category: Character
Alignment: left
See: The $UCS4X format in SAS National Language Support (NLS): User s Guide
Writes a native-endian, 32-bit, universal character set code in 4 octets (UCS4) character string in the encoding of the current SAS session
Category: Character
Alignment: left
See: The $UCS4XE format in SAS National Language Support (NLS): User s Guide
Writes a character string that is encoded in the current SAS session in Unicode escape (UESC) representation
Category: Character
Alignment: left
See: The $UESC format in SAS National Language Support (NLS): User s Guide
Writes a Unicode escape (UESC) representation character string in the encoding of the current SAS session
Category: Character
Alignment: left
See: The $UESCE format in SAS National Language Support (NLS): User s Guide
Writes a character string that is encoded in the current SAS session in numeric character representation (NCR)
Category: Character
Alignment: left
See: The $UNCR format in SAS National Language Support (NLS): User s Guide
Writes the numeric character representation (NCR) character string in the encoding of the current SAS session
Category: Character
Alignment: left
See: The $UNCRE format in SAS National Language Support (NLS): User s Guide
Writes a character string that is encoded in the current SAS session in Unicode parenthesis (UPAREN) representation
Category: Character
Alignment: left
See: The $UPAREN format in SAS National Language Support (NLS): User s Guide
Writes a character string that is in Unicode parenthesis (UPAREN) in a character string that is encoded in the current SAS session
Category: Character
Alignment: left
See: The $UPARENE format in SAS National Language Support (NLS): User s Guide
Converts character data to uppercase
Category: Character
Alignment: left
$ UPCASE w .
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
Special characters, such as hyphens and other symbols, are not altered .
put @1 name $upcase9.;
When name = ... | The Result is ... |
---|---|
----+----1 | |
coxe-ryan | COXE-RYAN |
Writes a character string in universal transformation format (UTF-8) encoding
Category: Character
Alignment: left
See: The $UTF8X format in SAS National Language Support (NLS): User s Guide
Writes character data of varying length
Valid: in DATA step
Category: Character
Alignment: left
$VARYING w. length-variable
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 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.
Requirement: You must specify length-variable immediately after $VARYING w .in a SAS statement.
Restriction: Length-variable cannot be an array reference.
Tip: If the value of length-variable is 0, negative, or missing, SAS writes nothing to the output field. If the value of length-variable is greater than 0 but less than w , SAS writes the number of characters that are specified by length-variable . If length-variable is greater than or equal to w , SAS writes w columns .
Use $VARYING w . when the length of a character value differs from record to record. After writing a data value with $VARYING w ., the pointer s position is the first column after the value.
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.
When name [*] = ... | The Result is ... |
---|---|
New York 8 Toronto 7 Buenos Aires 12 Tokyo 5 | ----+----1----+----2----+ New York Toronto Buenos Aires Tokyo |
[*] The value of NAME appears before the value of VARLEN. |
Use the LENGTH function to determine the length of a variable. The data values and the results follow the explanation of these SAS statements:
varlen=length(name); put @10 name $varying12. varlen;
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.
Values [*] | Results |
---|---|
New York Toronto Buenos Aires Tokyo | ----+----1----+----2----+ New York Toronto Buenos Aires Tokyo |
[*] The value of NAME appears before the value of VARLEN. |
Writes a character string in visual order to left-to-right logical order
Category: BIDI text handling
Alignment: left
See: The $VSLOG format in SAS National Language Support (NLS): User s Guide
Writes a character string in visual order to right-to-left logical order
Category: BIDI text handling
Alignment: left
See: The $VSLOGR format in SAS National Language Support (NLS): User s Guide
Writes standard character data
Category: Character
Alignment: left
Alias: $F w .
$ w.
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 length of the variable
Range: 1 “32767
The $ w . format and the $CHAR w . format are identical, and they do not trim leading blanks. To trim leading blanks, use the LEFT function to left align character data prior to output, or use list output with the colon (:) format modifier and the format of your choice.
put @10 name .; put name $ 10-15;
Values [*] | Results |
---|---|
#Cary Tokyo | ----+----1----+----2 Cary Tokyo |
[*] The character # represents a blank space. |
SAS chooses the best notation
Category: Numeric
Alignment: right
See: BEST w . Format in the documentation for your operating environment.
BEST w.
w
specifies the width of the output field.
Default: 12
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, then use a field width of at least 8.
Range: 1 “32
The BEST w . format is the default format for writing numeric values. When there is no format specification, SAS chooses the format that provides the most information about the value according to the available field width. BEST w . rounds the value, and if SAS can display at least one significant digit in the decimal portion, within the width specified, BEST w . produces the result in decimal. Otherwise, it produces the result in scientific notation. SAS always stores the complete value regardless of the format that you use to represent it.
The following statements produce these results.
SAS Statements | Results |
---|---|
x=1257000 put x best6.; x=1257000 put x best3.; | ----+----1----+----2 1.26E6 1E6 |
Converts numeric values to binary representation
Category: Numeric
Alignment: left
BINARY w.
w
specifies the width of the output field.
Default: 8
Range: 1 “64
BINARY w . converts numeric values to binary representation. The $BINARY w . format converts character values to binary representation.
put @1 x binary8.;
When x = ... | The Result is ... |
---|---|
----+----1 | |
123.45 | 01111011 |
123 | 01111011 |
-123 | 10000101 |
Writes numeric values with a comma that separates every three digits and a period that separates the decimal fraction
Category: Numeric
Alignment: right
COMMA w . d
w
specifies the width of the output field.
Default: 6
Range: 2 “32
Tip: Make w wide enough to write the numeric values, the commas, and the optional decimal point.
d
optionally specifies the number of digits to the right of the decimal point in the numeric value.
Range: 0 “31
Requirement: must be less than w
The COMMA w . d format writes numeric values with a comma that separates every three digits and a period that separates the decimal fraction.
The COMMA w . d format is similar to the COMMAX w . d format, but the COMMAX w . d format reverses the roles of the decimal point and the comma. This convention is common in European countries .
The COMMA w . d format is similar to the DOLLAR w . d format except that the COMMA w . d format does not print a leading dollar sign.
put @10 sales comma10.2;
When sales = ... | The result is ... |
---|---|
23451.23 123451.234 | ----+----1----+----2 23,451.23 123,451.23 |
Formats:
COMMAX w . d Format on page 116
DOLLAR w . d Format on page 127
Writes numeric values with a period that separates every three digits and a comma that separates the decimal fraction
Category: Numeric
Alignment: right
COMMAX w . d
w
specifies the width of the output field.
Default: 6
Range: 2 “32
Tip: Make w wide enough to write the numeric values, the commas, and the optional decimal point.
d
optionally specifies the number of digits to the right of the decimal point in the numeric value.
Range: 0 “31
Requirement: must be less than w
The COMMAX w . d format writes numeric values with a period that separates every three digits and with a comma that separates the decimal fraction.
The COMMA w . d format is similar to the COMMAX w . d format, but the COMMAX w . d format reverses the roles of the decimal point and the comma. This convention is common in European countries.
put @10 sales commax10.2;
When sales = ... | The result is ... |
---|---|
23451.23 123451.234 | ----+----1----+----2 23.451,23 123.451,23 |
Prints variables , possibly with a great range of values, lining up decimal places for values of similar magnitude
Category: Numeric
Alignment: right
D w . s
w
optionally specifies the width of the output field.
Default: 12
Range: 1 “32
s
optionally specifies the significant digits.
Default: 3
Range: 0 “16
Requirement: must be less than w
The D w.s format writes numbers so that the decimal point aligns in groups of values with similar magnitude.
The BEST w . 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.
D w.s writes numbers with the desired precision and more alignment than BEST w .
The w . d format aligns decimal points, if possible, but does not necessarily show the same precision for all numbers.
put @1 x d10.4;
When x = ... | The Result is ... |
---|---|
12345 1234.5 123.45 12.345 1.2345 .12345 | ----+----1----+----2 12345.0 1234.5 123.45000 12.34500 1.23450 0.12345 |
Writes date values in the form ddmmmyy or ddmmmyyyy
Category: Date and Time
Alignment: right
DATE w.
w
specifies the width of the output field.
Default: 7
Range: 5 “9
Tip: Use a width of 9 to print a 4 “digit year.
The DATE w . format writes SAS date values in the form ddmmmyy or ddmmmyyyy , where
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.
The example table uses the input value of 15780, which is the SAS date value that corresponds to March 16, 2003.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+ | |
put day date5.; | 16MAR |
put day date6.; | 16MAR |
put day date7.; | 16MAR03 |
put day date8.; | 16MAR03 |
put day date9.; | 16MAR2003 |
Function:
DATE Function on page 481
Informat:
DATE w . Informat on page 977
Writes datetime values in the form ddmmmyy:hh:mm:ss.ss with AM or PM
Category: Date and Time
Alignment: right
DATEAMPM w.d
w
specifies the width of the output field.
Default: 19
Range: 7 “40
Tip: SAS requires a minimum w value of 13 to write AM or PM. For widths between 10 and 12, SAS writes a 24- hour clock time.
d
optionally specifies the number of digits to the right of the decimal point in the seconds value.
Requirement: must be less than w
Range: 0 “39
Note: If w “ d < 17, SAS truncates the decimal values.
The DATEAMPM w . d format writes SAS datetime values in the form ddmmmyy:hh:mm:ss.ss , where
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.
The DATEAMPM w . d format is similar to the DATETIME w . d format except that DATEAMPM w . d prints AM or PM at the end of the time.
The example table uses the input value of 1347455694, which is the SAS datetime value that corresponds to 11:01:34 AM on April 20, 2003.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+----2----+ | |
put event dateampm.; | 20APR03:11:01:34 AM |
put event dateampm7.; | 20APR03 |
put event dateampm10.; | 20APR:11 |
put event dateampm13.; | 20APR03:11 AM |
put event dateampm22.2; | 20APR03:11:01:34.00 AM |
Format:
DATETIME w . d Format on page 121
Writes datetime values in the form ddmmmyy:hh:mm:ss.ss
Category: Date and Time
Alignment: right
DATETIME w.d
w
specifies the width of the output field.
Default: 16
Range: 7 “40
Tip: SAS requires a minimum w value of 16 to write a SAS datetime value with the date, hour, and seconds. Add an additional two places to w and a value to d to return values with optional decimal fractions of seconds.
d
optionally specifies the number of digits to the right of the decimal point in the seconds value.
Requirement: must be less than w
Range: 0 “39
Note: If w “ d < 17, SAS truncates the decimal values.
The DATETIME w . d format writes SAS datetime values in the form ddmmmyy:hh:mm:ss.ss , where
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.
The example table uses the input value of 1447213759, which is the SAS datetime value that corresponds to 3:49:19 AM on November 10, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+----2 | |
put event datetime.; put event datetime7.; put event datetime12.; put event datetime18.; put event datetime18.1; put event datetime19.; put event datetime20.1; put event datetime21.2; | 10NOV05:03:49:19 10NOV05 10NOV05:03 10NOV05:03:49:19 10NOV05:03:49:19.0 10NOV2005:03:49:19 10NOV2005:03:49:19.0 10NOV2005:03:49:19.00 |
Formats:
DATE w . Format on page 118
TIME w . d Format on page 210
Function:
DATETIME Function on page 483
Informats:
DATE w . Informat on page 977
DATETIME w . Informat on page 978
TIME w . Informat on page 1035
Writes date values as the day of the month
Category: Date and Time
Alignment: right
DAY w.
w
specifies the width of the output field.
Default: 2
Range: 2 “32
The example table uses the input value of 16601, which is the SAS date value that corresponds to June 14, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
put date day2.; | 14 |
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 2 or 4 digits
Category: Date and Time
Alignment: right
DDMMYY w.
w
specifies the width of the output field.
Default: 8
Range: 2 “10
Interaction: When w has a value of 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 .
The DDMMYY w . format writes SAS date values in the form ddmm < yy > yy or dd / mm / < yy > yy , where
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.
The following examples use the input value of 16794, which is the SAS date value that corresponds to December 24, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+ | |
put date ddmmyy5.; | 24/12 |
put date ddmmyy6.; | 241205 |
put date ddmmyy7.; | 241205 |
put date ddmmyy8.; | 24/12/05 |
put date ddmmyy10.; | 24/12/2005 |
Formats:
DATE w . Format on page 118
DDMMYY xw . Format on page 125
MMDDYY w . Format on page 163
YYMMDD w . Format on page 230
Function:
MDY Function on page 643
Informats:
DATE w . Informat on page 977
DDMMYY w . Informat on page 980
MMDDYY w . Informat on page 991
YYMMDD w . Informat on page 1042
Writes date values in the form ddmm < yy > yy or dd X mm X< yy > yy , where X represents a specified separator and the year appears as either 2 or 4 digits
Category: Date and Time
Alignment: right
DDMMYY xw.
x
identifies a separator or specifies that no separator appear between the day, the month, and the year. Valid values for x are:
B
separates with a blank
C
separates with a colon
D
separates with a dash
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
Interaction: When w has a value of 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 separators.
Interaction: When x has a value of N, the width range changes to 2 “8.
The DDMMYY xw . format writes SAS date values in the form ddmm < yy > yy or dd X mm X< yy > yy , where
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.
The following examples use the input value of 16511, which is the SAS date value that corresponds to March 16, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+ | |
put date ddmmyyc5.; | 16:03 |
put date ddmmyyd8.; | 16-03-05 |
put date ddmmyyp10.; | 16.03.2005 |
put date ddmmyyn8.; | 16032005 |
Formats:
DATE w . Format on page 118
DDMMYY w . Format on page 124
MMDDYY xw . Format on page 165
YYMMDD xw . Format on page 231
Functions:
DAY Function on page 483
MDY Function on page 643
MONTH Function on page 655
YEAR Function on page 914
Informat:
DDMMYY w . Informat on page 980
Writes numeric values with a leading dollar sign, a comma that separates every three digits, and a period that separates the decimal fraction
Category: Numeric
Alignment: right
DOLLAR w . d
w
specifies the width of the output field.
Default: 6
Range: 2 “32
d
optionally specifies the number of digits to the right of the decimal point in the
numeric value.
Range: 0 “31
Requirement: must be less than w
The DOLLAR w . 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 DOLLAR w . d always produces one of these codes. If you need another monetary character, define your own format with the FORMAT procedure. See the The FORMAT Procedure in Base SAS Procedures Guide for more details.
The DOLLAR w . d format is similar to the DOLLARX w . d format, but the DOLLARX w . d format reverses the roles of the decimal point and the comma. This convention is common in European countries.
The DOLLAR w . d format is the same as the COMMA w . d format except that the COMMA w . d format does not write a leading dollar sign.
put @3 netpay dollar10.2;
When netpay = ... | The result is ... |
---|---|
----+----1----+ | |
1254.71 | ,254.71 |
Formats:
COMMA w . d Format on page 115
DOLLARX w . d Format on page 128
Writes numeric values with a leading dollar sign, a period that separates every three digits, and a comma that separates the decimal fraction
Category: Numeric
Alignment: right
DOLLARX w . d
w
specifies the width of the output field.
Default: 6
Range: 2 “32
d
optionally specifies the number of digits to the right of the decimal point in the numeric value.
Default: 6
Range: 2 “31
Requirement: must be less than w
The DOLLARX w . 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 DOLLARX w . d always produces one of these codes. If you need another monetary character, define your own format with the FORMAT procedure. See The FORMAT Procedure in Base SAS Procedures Guide for more details.
The DOLLARX w . d format is similar to the DOLLAR w . d format, but the DOLLARX w . d format reverses the roles of the decimal point and the comma. This convention is common in European countries.
The DOLLARX w . d format is the same as the COMMAX w . d format except that the COMMA w . d format does not write a leading dollar sign.
put @3 netpay dollarx10.2;
When netpay = ... | The result is ... |
---|---|
----+----1----+ | |
1254.71 | .254,71 |
Formats:
COMMAX w . d Format on page 116
DOLLAR w . d Format on page 127
Writes date values as the name of the day of the week
Category: Date and Time
Alignment: right
DOWNAME w.
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.
If necessary, SAS truncates the name of the day to fit the format width. For example, the DOWNAME2. prints the first two letters of the day name.
The example table uses the input value of 13589, which is the SAS date value that corresponds to March 16, 1997.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
put date downame.; | Sunday |
Format:
WEEKDAY w . Format on page 220
Expects a datetime value as input and writes date values in the form ddmmmyy or ddmmmyyyy
Category: Date and Time
Alignment: right
DTDATE w.
w
specifies the width of the output field.
Default: 7
Range: 5 “9
Tip: Use a width of 9 to print a 4 “digit year.
The DTDATE w . format writes SAS date values in the form ddmmmyy or ddmmmyyyy , where
dd
is an integer 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.
The DTDATE w . format produces the same type of output that the DATE w . format produces. The difference is that the DTDATE w . format requires a datetime value.
The example table uses a datetime value of 16APR2000:10:00:00 as input, and prints both a two-digit and a four-digit year for the DTDATE w . format.
When the SAS statement is ... | The Result is ... |
---|---|
----+----+ | |
put trip_date=dtdate.; | 16APR00 |
put trip_date=dtdate9.; | 16APR2000 |
Formats:
DATE w . Format on page 118
Writes the date part of a datetime value as the month and year in the form mmmyy or mmmyyyy
Category: Date and Time
Alignment: right
DTMONYY w.
w
specifies the width of the output field.
Default: 5
Range: 5 “7
The DTMONYY w . format writes SAS datetime values in the form mmmyy or mmmyyyy , where
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.
The DTMONYY w . format and the MONYY w . format are similar in that they both write date values. The difference is that DTMONYY w . expects a datetime value as input, and MONYY w . expects a SAS date value.
The example table uses as input the value 1476598132, which is the SAS datetime value that corresponds to October 16, 2006, at 06:08:52 AM.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
put date dtmonyy.; | OCT06 |
put date dtmonyy5.; | OCT06 |
put date dtmonyy6.; | OCT06 |
put date dtmonyy7.; | OCT2006 |
Formats:
DATETIME w . d Format on page 121
MONYY w . Format on page 173
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 )
Category: Date and Time
Alignment: right
DTWKDATX w .
w
specifies the width of the output field.
Default: 29
Range: 3 “37
The DTWKDATX w . format writes SAS date values in the form day-of-week , dd month-name , yy or yyyy , where
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.
The DTWKDATX w . format is similar to the WEEKDATX w . format in that they both write date values. The difference is that DTWKDATX w . expects a datetime value as input, and WEEKDATX w . expects a SAS date value.
The example table uses as input the value 1476598132, which is the SAS datetime value that corresponds to October 16, 2002, at 06:08:52 AM.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+----2----+----3 | |
put date dtwkdatx.; put date dtwkdatx3.; put date dtwkdatx8.; put date dtwkdatx25.; | Monday, 16 October 2006 Mon Mon Monday, 16 Oct 2006 |
Formats:
DATETIME w . d Format on page 121
WEEKDATX w . Format on page 218
Writes the date part of a datetime value as the year in the form yy or yyyy
Category: Date and Time
Alignment: right
DTYEAR w .
w
specifies the width of the output field.
Default: 4
Range: 2 “4
The DTYEAR w . format is similar to the YEAR w . format in that they both write date values. The difference is that DTYEAR w . expects a datetime value as input, and YEAR w . expects a SAS date value.
The example table uses as input the value 1476598132, which is the SAS datetime value that corresponds to October 16, 2006, at 06:08:52 AM.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
put date dtyear.; | 2006 |
put date dtyear2.; | 06 |
put date dtyear3.; | 06 |
put date year4.; | 2006 |
Formats:
DATETIME w . d Format on page 121
YEAR w . Format on page 226
Writes the date part of a datetime value as the year and the quarter and separates them with a colon (:)
Category: Date and Time
Alignment: right
DTYYQC w.
w
specifies the width of the output field.
Default: 4
Range: 4 “6
The DTYYQC w . 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.
The example table uses as input the value 1476598132, which is the SAS datetime value that corresponds to October 16, 2006, at 06:08:52 PM.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
put date dtyyqc.; | 06:4 |
put date dtyyqc4.; | 06:4 |
put date dtyyqc5.; | 06:4 |
put date dtyyqc6.; | 2006:4 |
Formats:
DATETIME w . d Format on page 121
Writes numeric values in scientific notation
Category: Numeric
Alignment: right
See: E w . Format in the documentation for your operating environment.
E w.
w
specifies the width of the output field.
Default: 12
Range: 7 “32
SAS reserves the first column of the result for a minus sign.
put @1 x e10.;
When x = ... | The Result is ... |
---|---|
----+----1----+ | |
1257 | 1.257E+03 |
-1257 | -1.257E+03 |
Writes international date values in the form dd.mm.yy or dd.mm.yyyy
Category: Date and Time
Alignment: right
See: The EURDFDD format in SAS National Language Support (NLS): User s Guide
Writes international date values in the form ddmmmyy or ddmmmyyyy
Category: Date and Time
Alignment: right
See: The EURDFDE format in SAS National Language Support (NLS): User s Guide
Writes international date values as the day of the week
Category: Date and Time
Alignment: right
See: The EURDFDN format in SAS National Language Support (NLS): User s Guide
Writes international datetime values in the form ddmmmyy:hh:mm:ss.ss or ddmmmyyyy hh:mm:ss.ss
Category: Date and Time
Alignment: right
See: The EURDFDT format in SAS National Language Support (NLS): User s Guide
Writes international date values as the name of the day
Category: Date and Time
Alignment: right
See: The EURDFDWN format in SAS National Language Support (NLS): User s Guide
Writes international date values as the name of the month
Category: Date and Time
Alignment: right
See: The EURDFMN format in SAS National Language Support (NLS): User s Guide
Writes international date values in the form mmmyy or mmmyyyy
Category: Date and Time
Alignment: right
See: The EURDFMY format in SAS National Language Support (NLS): User s Guide
Writes international date values as the name of the month, the day, and the year in the form dd month-name yy (or yyyy )
Category: Date and Time
Alignment: right
See: The EURDFWDX format in SAS National Language Support (NLS): User s Guide
Writes international date values as the name of the day and date in the form day-of-week , dd month-name yy (or yyyy )
Category: Date and Time
Alignment: right
See: The EURDFWKX format in SAS National Language Support (NLS): User s Guide
Converts an amount from Austrian schillings to euros
Category: Currency Conversion
Alignment: right
See: The EURFRATS format in SAS National Language Support (NLS): User s Guide
Converts an amount from Belgian francs to euros
Category: Currency Conversion
Alignment: right
See: The EURFRBEF format in SAS National Language Support (NLS): User s Guide
Converts an amount from Swiss francs to euros
Category: Currency Conversion
Alignment: right
See: The EURFRCHF format in SAS National Language Support (NLS): User s Guide
Converts an amount from Czech koruny to euros
Category: Currency Conversion
Alignment: right
See: The EURFRCZK format in SAS National Language Support (NLS): User s Guide
Converts an amount from Deutsche marks to euros
Category: Currency Conversion
Alignment: right
See: The EURFRDEM format in SAS National Language Support (NLS): User s Guide
Converts an amount from Danish kroner to euros
Category: Currency Conversion
Alignment: right
See: The EURFRDKK format in SAS National Language Support (NLS): User s Guide
Converts an amount from Spanish pesetas to euros
Category: Currency Conversion
Alignment: right
See: The EURFRESP format in SAS National Language Support (NLS): User s Guide
Converts an amount from Finnish markkaa to euros
Category: Currency Conversion
Alignment: right
See: The EURFRFIM format in SAS National Language Support (NLS): User s Guide
Converts an amount from French francs to euros
Category: Currency Conversion
Alignment: right
See: The EURFRFRF format in SAS National Language Support (NLS): User s Guide
Converts an amount from British pounds to euros
Category: Currency Conversion
Alignment: right
See: The EURFRGBP format in SAS National Language Support (NLS): User s Guide
Converts an amount from Greek drachmas to euros
Category: Currency Conversion
Alignment: right
See: The EURFRGRD format in SAS National Language Support (NLS): User s Guide
Converts an amount from Hungarian forints to euros
Category: Currency Conversion
Alignment: right
See: The EURFRHUF format in SAS National Language Support (NLS): User s Guide
Converts an amount from Irish pounds to euros
Category: Currency Conversion
Alignment: right
See: The EURFRIEP format in SAS National Language Support (NLS): User s Guide
Converts an amount from Italian lire to euros
Category: Currency Conversion
Alignment: right
See: The EURFRITL format in SAS National Language Support (NLS): User s Guide
Converts an amount from Luxembourg francs to euros
Category: Currency Conversion
Alignment: right
See: The EURFRLUF format in SAS National Language Support (NLS): User s Guide
Converts an amount from Dutch guilders to euros
Category: Currency Conversion
Alignment: right
See: The EURFRNLG format in SAS National Language Support (NLS): User s Guide
Converts an amount from Norwegian krone to euros
Category: Currency Conversion
Alignment: right
See: The EURFRNOK format in SAS National Language Support (NLS): User s Guide
Converts an amount from Polish zlotys to euros
Category: Currency Conversion
Alignment: right
See: The EUFRRPLZ format in SAS National Language Support (NLS): User s Guide
Converts an amount from Portuguese escudos to euros
Category: Currency Conversion
Alignment: right
See: The EURFRPTE format in SAS National Language Support (NLS): User s Guide
Converts an amount from Romanian lei to euros
Category: Currency Conversion
Alignment: right
See: The EURFRROL format in SAS National Language Support (NLS): User s Guide
Converts an amount from Russian rubles to euros
Category: Currency Conversion
Alignment: right
See: The EURFRRUR format in SAS National Language Support (NLS): User s Guide
Converts an amount from Swedish kronor to euros
Category: Currency Conversion
Alignment: right
See: The EURFRSEK format in SAS National Language Support (NLS): User s Guide
Converts an amount from Slovenian tolars to euros
Category: Currency Conversion
Alignment: right
See: The EURFRSIT format in SAS National Language Support (NLS): User s Guide
Converts an amount from Turkish liras to euros
Category: Currency Conversion
Alignment: right
See: The EURFRTRL format in SAS National Language Support (NLS): User s Guide
Converts an amount from Yugoslavian dinars to euros
Category: Currency Conversion
Alignment: right
See: The EURFRYUD format in SAS National Language Support (NLS): User s Guide
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
See: The EURO format in SAS National Language Support (NLS): User s Guide
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
See: The EUROX format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Austrian schillings
Category: Currency Conversion
Alignment: right
See: The EURTOATS format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Belgian francs
Category: Currency Conversion
Alignment: right
See: The EURTOBEF format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Swiss francs
Category: Currency Conversion
Alignment: right
See: The EURTOCHF format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Czech koruny
Category: Currency Conversion
Alignment: right
See: The EURTOCZK format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Deutsche marks
Category: Currency Conversion
Alignment: right
See: The EURTODEM format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Danish kroner
Category: Currency Conversion
Alignment: right
See: The EURTODKK format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Spanish pesetas
Category: Currency Conversion
Alignment: right
See: The EURTOESP format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Finnish markkaa
Category: Currency Conversion
Alignment: right
See: The EURTOFIM format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to French francs
Category: Currency Conversion
Alignment: right
See: The EURTOFRF format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to British pounds
Category: Currency Conversion
Alignment: right
See: The EURTOGBP format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Greek drachmas
Category: Currency Conversion
Alignment: right
See: The EURTOGRD format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Hungarian forints
Category: Currency Conversion
Alignment: right
See: The EURTOHUF format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Irish pounds
Category: Currency Conversion
Alignment: right
See: The EURTOIEP format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Italian lire
Category: Currency Conversion
Alignment: right
See: The EURTOITL format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Luxembourg francs
Category: Currency Conversion
Alignment: right
See: The EURTOLUF format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Dutch guilders
Category: Currency Conversion
Alignment: right
See: The EURTONLG format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Norwegian krone
Category: Currency Conversion
Alignment: right
See: The EURTONOK format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Polish zlotys
Category: Currency Conversion
Alignment: right
See: The EURTOPLZ format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Portuguese escudos
Category: Currency Conversion
Alignment: right
See: The EURTOPTE format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Romanian lei
Category: Currency Conversion
Alignment: right
See: The EURTOROL format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Russian rubles
Category: Currency Conversion
Alignment: right
See: The EURTORUR format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Swedish kronor
Category: Currency Conversion
Alignment: right
See: The EURTOSEK format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Slovenian tolars
Category: Currency Conversion
Alignment: right
See: The EURTOSIT format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Turkish liras
Category: Currency Conversion
Alignment: right
See: The EURTOTRL format in SAS National Language Support (NLS): User s Guide
Converts an amount in euros to Yugoslavian dinars
Category: Currency Conversion
Alignment: right
See: The EURTOYUD format in SAS National Language Support (NLS): User s Guide
Generates a native single-precision, floating-point value by multiplying a number by 10 raised to the d th power
Category: Numeric
Alignment: left
FLOAT w.d
w
specifies the width of the output field.
Requirement: width must be 4
d
optionally specifies the power of 10 by which to divide the value.
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. typically are those meant to be read by some other external program that runs in your operating environment and that expects these single-precision values.
Note: If the value that is to be formatted is a missing value, or if it is out-of-range for a native single-precision, floating-point value, a single-precision value of zero is generated.
On IBM mainframe systems, a four-byte floating-point number is the same as a truncated eight-byte floating-point number. However, in operating environments using the IEEE floating-point standard, such as IBM PC-based operating environments and most UNIX operating environments, a four-byte floating-point number is not the same as a truncated double. Hence, the RB4. format does not produce the same results as the FLOAT4. format. Floating-point representations other than IEEE may have this same characteristic.
The following table compares the names of float notation in several programming languages:
Language | Float Notation |
---|---|
SAS | FLOAT4 |
FORTRAN | REAL+4 |
C | float |
IBM 370 ASM | E |
PL/I | FLOAT BIN(21) |
put x float4.;
When x = ... | The Result [*] is ... |
---|---|
1 | 3F800000 |
[*] The result is a hexadecimal representation of a binary number that is stored in IEEE form. |
Converts numeric values to fractions
Category: Numeric
Alignment: right
FRACT w.
w
specifies the width of the output field.
Default: 10
Range: 4 “32
Dividing the number 1 by 3 produces the value 0.33333333. To write this value as 1/3, use the FRACT w . format. FRACT w . writes fractions in reduced form, that is, 1/2 instead of 50/100.
put x fract8.;
When x = ... | The Result is ... |
---|---|
----+----1 | |
0.6666666667 | 2/3 |
0.2784 | 174/625 |
Writes date values in the form yyyy mmmmm dd where dd is the day-of-the-month, mmmmm represents the month s name in Hebrew, and yyyy is the year
Category: Date and Time
Alignment: right
See: The HDATE format in SAS National Language Support (NLS): User s Guide
Writes date values according to the Jewish calendar
Category: Date and Time
Alignment: right
See: The HEBDATE format in SAS National Language Support (NLS): User s Guide
Converts real binary (floating-point) values to hexadecimal representation
Category: Numeric
Alignment: left
See: HEX w . Format in the documentation for your operating environment.
HEX w.
w
specifies the width of the output field.
Default: 8
Range: 1 “16
Tip: If w < 16, the HEX w . format converts real binary numbers to fixed-point integers before writing them as hexadecimal digits. It also writes negative numbers in two s complement notation, and right aligns digits. If w is 16, HEX w . displays floating-point values in their hexadecimal form.
In any operating environment, the least significant byte written by HEX w . is the rightmost byte. Some operating environments store integers with the least significant digit as the first byte. The HEX w . format produces consistent results in any operating environment regardless of the order of significance by byte.
Note: Different operating environments store floating-point values in different ways. However, the HEX16. format writes hexadecimal representations of floating-point values with consistent results in the same way that your operating environment stores them.
The HEX w . numeric format and the $HEX w . character format both generate the hexadecimal equivalent of values.
put @8 x hex8.;
When x = ... | The Result is ... |
---|---|
35.4 88 2.33 150 | ----+----1----+----2 00000023 00000058 00000002 FFFFFF6A |
Writes time values as hours and minutes in the form hh:mm
Category: Date and Time
Alignment: right
HHMM w.d
w
specifies the width of the output field.
Default: 5
Range: 2 “20
d
optionally specifies the number of digits to the right of the decimal point in the minutes value.
Requirement: must be less than w
Range: 1 “19
The HHMM w . d format writes SAS datetime values in the form hh:mm , where
hh
is an integer.
mm
is the number of minutes that range from 00 through 59.
SAS rounds hours and minutes that are based on the value of seconds in a SAS time value.
The HHMM w . d format is similar to the TIME w . d format except that the HHMM w . d format does not print seconds.
The example table uses the input value of 46796, which is the SAS time value that corresponds to 12:59:56 PM.
When the SAS statement is ... | The result is ... |
---|---|
----+----1 | |
put time hhmm.; | 13:00 |
SAS rounds up the time value four seconds based on the value of seconds in the SAS time value.
Formats:
HOUR w . d Format on page 156
MMSS w . d Format on page 167
TIME w . d Format on page 210
Functions:
HMS Function on page 578
HOUR Function on page 579
MINUTE Function on page 647
SECOND Function on page 819
TIME Function on page 855
Informat:
TIME w . Informat on page 1035
Writes time values as hours and decimal fractions of hours
Category: Date and Time
Alignment: right
HOUR w.d
w
specifies the width of the output field.
Default: 2
Range: 2 “20
d
optionally specifies the number of digits to the right of the decimal point in the hour value. Therefore, SAS prints decimal fractions of the hour.
Requirement: must be less than w
Range: 0-19
SAS rounds hours based on the value of minutes in the SAS time value.
The example table uses the input value of 41400, which is the SAS time value that corresponds to 11:30 AM.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
put time hour4.1; | 11.5 |
Formats:
HHMM w . d Format on page 155
MMSS w . d Format on page 167
TIME w . d Format on page 210
TOD w.d Format on page 213
Functions:
HMS Function on page 578
HOUR Function on page 579
MINUTE Function on page 647
SECOND Function on page 819
TIME Function on page 855
Informat:
TIME w . Informat on page 1035
Writes native integer binary (fixed-point) values, including negative values
Category: Numeric
Alignment: left
See: IB w . d Format in the documentation for your operating environment.
IB w . d
w
specifies the width of the output field.
Default: 4
Range: 1 “8
d
optionally specifies to multiply the number by 10 d .
The IB w.d format writes integer binary (fixed-point) values, including negative values that are represented in two s complement notation. IB w.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.
Note: Different operating environments store integer binary values in different ways. This concept is called byte ordering. For a detailed discussion about byte ordering, see Byte Ordering for Integer Binary Data on Big Endian and Little Endian Platforms on page 75.
The IB w . d and PIB w . d formats are used to write native format integers. (Native format allows you to read and write values created in the same operating environment.) The IBR w . d and PIBR w . 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 Table 3.1 on page 76.
To view a table that compares integer binary notation in several programming languages, see Table 3.2 on page 76.
y=put(x,ib4.); put y $hex8.;
When x = ... | The Result on Big Endian Platforms [*] is ... | The Result on Little Endian Platforms [*] is ... |
---|---|---|
----+----1 | ----+----1 | |
128 | 00000080 | 80000000 |
[*] The result is a hexadecimal representation of a four-byte integer binary number. Each byte occupies one column of the output field. |
Format:
IBR w . d Format on page 159
Writes integer binary (fixed-point) values in Intel and DEC formats
Category: Numeric
Alignment: left
IBR w . d
w
specifies the width of the output field.
Default: 4
Range: 1 “8
d
optionally specifies to multiply the number by 10 d .
The IBR w.d format writes integer binary (fixed-point) values, including negative values that are represented in two s complement notation. IBR w.d writes integer binary values that are generated by and for Intel and DEC operating environments. Use IBR w.d to write integer binary data from Intel or DEC environments on other operating environments. The IBR w.d format in SAS code allows for a portable implementation for writing the data in any operating environment.
Note: Different operating environments store integer binary values in different ways. This concept is called byte ordering. For a detailed discussion about byte ordering, see Byte Ordering for Integer Binary Data on Big Endian and Little Endian Platforms on page 75.
The IB w . d and PIB w . d formats are used to write native format integers. (Native format allows you to read and write values that are created in the same operating environment.)
The IBR w . d and PIBR w . d formats are used to write little endian integers, regardless of the operating environment you are writing on.
In Intel and DEC operating environments, the IB w . d and IBR w . d formats are equivalent.
To view a table that shows the type of format to use with big endian and little endian integers, see Table 3.1 on page 76.
To view a table that compares integer binary notation in several programming languages, see Table 3.2 on page 76.
y=put(x,ibr4.); put y $hex8.;
When x = ... | The Result [*] is ... |
---|---|
----+----1 | |
128 | 80000000 |
[*] The result is a hexadecimal representation of a 4-byte integer binary number. Each byte occupies one column of the output field. |
Format:
IB w . d Format on page 157
Generates an IEEE floating-point value by multiplying a number by 10 raised to the d th power
Category: Numeric
Alignment: left
IEEE w.d
w
specifies the width of the output field.
Default: 8
Range: 3 “8
Tip: If w is 8, an IEEE double-precision, floating-point number is written. If w is 5, 6, or 7, an IEEE double-precision, floating-point number is written, which assumes truncation of the appropriate number of bytes. If w is 4, an IEEE single-precision floating-point number is written. If w is 3, an IEEE single-precision, floating-point number is written, which assumes truncation of one byte.
d
optionally specifies to multiply the number by 10 d .
This format is useful in operating environments where IEEE w . d is the floating-point representation that is used. In addition, you can use the IEEE w . 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 IEEE w . d format allows other lengths, which enables you to write data to files that contain space-saving truncated data.
test1=put(x,ieee4.); put test1 $hex8.; test2=put(x,ieee5.); put test2 $hex10.;
When x = ... | The Result [*] is ... |
---|---|
1 | 3F800000 |
3FF0000000 | |
[*] The result contains hexadecimal representations of binary numbers stored in IEEE form. |
Writes date values as the Julian day of the year
Category: Date and Time
Alignment: right
JULDAY w.
w
specifies the width of the output field.
Default: 3
Range: 3 “32
The JULDAY w . format writes SAS date values in the form ddd , where
ddd
is the number of the day, 1 “365 (or 1 “366 for leap years ).
The example table uses the input values of 13515, which is the SAS date value that corresponds to January 1, 1997, and 13589, which is the SAS date value that corresponds to March 16, 1997.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
put date julday3.; | 1 |
put date julday3.; | 75 |
Writes date values as Julian dates in the form yyddd or yyyyddd
Category: Date and Time
Alignment: left
JULIAN w.
w
specifies the width of the output field.
Default: 5
Range: 5 “7
Tip: If w is 5, the JULIAN w . format writes the date with a two-digit year. If w is 7, the JULIAN w . format writes the date with a four-digit year.
The JULIAN w . format writes SAS date values in the form yyddd or yyyyddd , where
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.
The example table uses the input value of 16794, which is the SAS date value that corresponds to December 24, 2005 (the 358th day of the year).
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
put date julian5.; | 05358 |
put date julian7.; | 2005358 |
Functions:
DATEJUL Function on page 481
JULDATE Function on page 614
Informat:
JULIAN w . Informat on page 990
Writes date values as Taiwanese dates in the form yyymmdd
Category: Date and Time
Alignment: left
See: The MINGUO format in SAS National Language Support (NLS): User s Guide
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 2 or 4 digits
Category: Date and Time
Alignment: right
MMDDYY w.
w
specifies the width of the output field.
Default: 8
Range: 2 “10
Interaction: When w has a value of 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.
The MMDDYY w . format writes SAS date values in the form mmdd < yy > yy or mm / dd / < yy > yy , where
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.
The following examples use the input value of 16734, which is the SAS date value that corresponds to October 25, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+ | |
put day mmddyy2.; | 10 |
put day mmddyy3.; | 10 |
put day mmddyy4.; | 1025 |
put day mmddyy5.; | 10/25 |
put day mmddyy6.; | 102505 |
put day mmddyy7.; | 102505 |
put day mmddyy8.; | 10/25/05 |
put day mmddyy10.; | 10/25/2005 |
Formats:
DATE w . Format on page 118
DDMMYY w . Format on page 124
MMDDYY xw . Format on page 165
YYMMDD w . Format on page 230
Functions:
DAY Function on page 483
MDY Function on page 643
MONTH Function on page 655
YEAR Function on page 914
Informats:
DATE w . Informat on page 977
DDMMYY w . Informat on page 980
YYMMDD w . Informat on page 1042
Writes date values in the form mmdd < yy > yy or mm X dd X< yy > yy , where X represents a specified separator and the year appears as either 2 or 4 digits
Category: Date and Time
Alignment: right
MMDDYY xw.
x
identifies a separator or specifies that no separator appear between the month, the day, and the year. Valid values for x are:
B
separates with a blank
C
separates with a colon
D
separates with a dash
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
Interaction: When w has a value of 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.
Interaction: When x has a value of N, the width range changes to 2 “8.
The MMDDYY xw . format writes SAS date values in the form mmdd < yy > yy or mm X dd X< yy > yy , where
mm
is an integer that represents the month.
X
is a specified 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.
The following examples use the input value of 16731, which is the SAS date value that corresponds to October 22, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+ | |
put day mmddyyc5.; | 10:22 |
put day mmddyyd8.; | 10-22-05 |
put day mmddyyp10.; | 10.22.2005 |
put day mmddyyn8.; | 10222005 |
Formats:
DATE w . Format on page 118
DDMMYY xw . Format on page 125
MMDDYY w . Format on page 163
YYMMDD xw . Format on page 231
Functions:
DAY Function on page 483
MDY Function on page 643
MONTH Function on page 655
YEAR Function on page 914
Informat:
MMDDYY w . Informat on page 991
Writes time values as the number of minutes and seconds since midnight
Category: Date and Time
Alignment: right
MMSS w.d
w
specifies the width of the output field.
Default: 5
Range: 2 “20
Tip: Set w to a minimum of 5 to write a value that represents minutes and seconds.
d
optionally specifies the number of digits to the right of the decimal point in the seconds value. Therefore, the SAS time value includes fractional seconds.
Range: 0 “19
Restriction: must be less than w
The example table uses the input value of 4530.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
put time mmss.; | 75:30 |
Formats:
HHMM w . d Format on page 155
TIME w . d Format on page 210
Functions:
HMS Function on page 578
MINUTE Function on page 647
SECOND Function on page 819
Informat:
TIME w . Informat on page 1035
Writes date values in the form mm M< yy > yy , where M is the separator and the year appears as either 2 or 4 digits
Category: Date and Time
Alignment: right
MMYY w.
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.
The MMYY w . format writes SAS date values in the form mm M< yy > yy , where
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.
The following examples use the input value of 16734, which is the SAS date value that corresponds to October 25, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+ | |
put date mmyy5.; put date mmyy6.; put date mmyy.; put date mmyy7.; put date mmyy10.; | 10M05 10M05 10M2005 10M2005 10M2005 |
Format:
MMYY xw . Format on page 169
YYMM w . Format on page 227
Writes date values in the form mm < yy > yy or mm X< yy > yy , where X represents a specified separator and the year appears as either 2 or 4 digits
Category: Date and Time
Alignment: right
MMYY xw.
x
identifies a separator or specifies that no separator appear between the month and the year. Valid values for x are
C
separates with a colon
D
separates with a dash
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
Interaction: When x is set to N, no separator is specified. The width range is then 4 “32, and the default changes to 6.
Interaction: When x has a value of C, D, P, or S and 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.
Interaction: When x has a value of N and w has a value of 4 or 5, the date appears with only the last two digits of the year. When x has a value of N and w is 6 or more, the date appears with a four-digit year.
The MMYY xw . format writes SAS date values in the form mm < yy > yy or mm X< yy > yy , where
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.
The following examples use the input value of 16631, which is the SAS date value that corresponds to July14, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+ | |
put date mmyyc5.; | 07:05 |
put date mmyyd.; | 07-2005 |
put date mmyyn4.; | 0705 |
put date mmyyp8.; | 07.2005 |
put date mmyys10.; | 07/2005 |
Format:
MMYY w . Format on page 168
YYMM xw . Format on page 228
Writes date values as the name of the month
Category: Date and Time
Alignment: right
MONNAME w.
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.
If necessary, SAS truncates the name of the month to fit the format width.
The example table uses the input value of 16500, which is the SAS date value that corresponds to March 5, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
put date monname1.; | M |
put date monname3.; | Mar |
put date monname5.; | March |
Format:
MONTH w . Format on page 172
Writes date values as the month of the year
Category: Date and Time
Alignment: right
MONTH w.
w
specifies the width of the output field.
Default: 2
Range: 1 “21
Tip: Use MONTH1. to obtain a hex value.
The MONTH w . format writes the month (1 through 12) of the year from a SAS date value.
The example table uses the input value of 15656, which is the SAS date value that corresponds to November 12, 2002.
When the SAS statement is ... | The result is ... |
---|---|
----+----1 | |
put date month.; | 11 |
Format:
MONNAME w . Format on page 171
Writes date values as the month and the year in the form mmmyy or mmmyyyy
Category: Date and Time
Alignment: right
MONYY w.
w
specifies the width of the output field.
Default: 5
Range: 5 “7
The MONYY w . format writes SAS date values in the form mmmyy or mmmyyyy , where
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.
The MONYY w . format and the DTMONYY w . format are similar in that they both write date values. The difference is that MONYY w . expects a SAS date value as input, and DTMONYY w . expects a datetime value.
The example table uses the input value of 16794, which is the SAS date value that corresponds to December 24, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
put date monyy5.; | DEC05 |
put date monyy7.; | DEC2005 |
Formats:
DTMONYY w . Format on page 132
DDMMYY w . Format on page 124
MMDDYY w . Format on page 163
YYMMDD w . Format on page 230
Functions:
MONTH Function on page 655
YEAR Function on page 914
Informat:
MONYY w . Informat on page 993
Writes negative numeric values in parentheses
Category: Numeric
Alignment: right
NEGPAREN w . d
w
specifies the width of the output field.
Default: 6
Range: 1 “32
d
optionally specifies the number of digits to the right of the decimal point in the numeric value.
The NEGPAREN w . d format attempts to right align output values. If the input value is negative, NEGPAREN w . 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 non-negative, NEGPAREN w . d displays the value with a leading and trailing blank to ensure proper column alignment. It reserves the last column for a right parenthesis even when the value is positive.
The NEGPAREN w . d format is similar to the COMMA w . d format in that it separates every three digits of the value with a comma.
put @1 sales negparen6.;
When sales = ... | The result is ... |
---|---|
100 1000 200 2000 | ----+----1----+ 100 1,000 (200) 2,000 |
Writes date values as Japanese dates in the form e.yymmdd
Category: Date and Time
Alignment: left
See: The NENGO format in SAS National Language Support (NLS): User s Guide
Converts a SAS date value to the date value of the specified locale and then writes the value in
the format of date
Category: Date and Time
See: The NLDATE format in SAS National Language Support (NLS): User s Guide
Converts a SAS date value to the date value of the specified locale and then writes the date value
in the format of name of month
Category: Date and Time
See: The NLDATEMN format in SAS National Language Support (NLS): User s Guide
Converts a SAS date value to the date value of the specified locale, and then writes the date value in the format of the date and the day of week
Category: Date and Time
See: The NLDATEW format in SAS National Language Support (NLS): User s Guide
Converts the SAS date value to the date value of the specified locale and then writes the date value in the format of the name of day of week
Category: Date and Time
See: The NLDATEWN format in SAS National Language Support (NLS): User s Guide
Converts a SAS datetime value to the datetime value of the specified locale and then writes the value in the format of datetime
Category: Date and Time
See: The NLDATM format in SAS National Language Support (NLS): User s Guide
Converts a SAS datetime value to the datetime value of the specified locale and then writes the value in the format of datetime with a.m. or p.m.
Category: Date and Time
See: The NLDATMAP format in SAS National Language Support (NLS): User s Guide
Converts the time portion of a SAS datetime value to the time-of-day value of the specified locale and then writes the value in the format of time of day
Category: Date and Time
See: The NLDATMTM format in SAS National Language Support (NLS): User s Guide
Converts a SAS date value to a datetime value of the specified locale and then writes the value in the format of day of week and datetime
Category: Date and Time
See: The NLDATMW format in SAS National Language Support (NLS): User s Guide
Writes the monetary format of the local expression in the specified locale using local currency
Category: Numeric
See: The NLMNY format in SAS National Language Support (NLS): User s Guide
Writes the monetary format of the international expression in the specified locale
Category: Numeric
See: The NLMNYI format in SAS National Language Support (NLS): User s Guide
Writes the numeric format of the local expression in the specified locale
Category: Numeric
See: The NLNUM format in SAS National Language Support (NLS): User s Guide
Writes the numeric format of the international expression in the specified locale
Category: Numeric
See: The NLNUMI format in SAS National Language Support (NLS): User s Guide
Writes percentage data of the local expression in the specified locale
Category: Numeric
See: The NLPCT format in SAS National Language Support (NLS): User s Guide
Writes percentage data of the international expression in the specified locale
Category: Numeric
See: The NLPCTI format in SAS National Language Support (NLS): User s Guide
Converts a SAS time value to the time value of a specified locale and then writes the value in the format of a time value with a.m. or p.m.
Category: Date and Time
See: The NLTIMAP format in SAS National Language Support (NLS): User s Guide
Converts a SAS time value to the time value of the specified locale and then writes the value in the format of time
Category: Date and Time
See: The NLTIME format in SAS National Language Support (NLS): User s Guide
Writes numeric values with a comma in place of the decimal point
Category: Numeric
Alignment: right
NUMX w.d
w
specifies the width of the output field.
Default: 12
Range: 1 “32
d
optionally specifies the number of digits to the right of the decimal point (comma) in the numeric value.
The NUMX w . d format writes numeric values with a comma in place of the decimal point.
The NUMX w . d format is similar to the w . d format except that NUMX w . d writes numeric values with a comma in place of the decimal point.
put x numx10.2;
When x = ... | The Result is ... |
---|---|
896.48 64.89 3064.10 | ----+----1----+ 896,48 64,89 3064,10 |
Format:
w . d Format on page 215
Informat:
NUMX w . d Informat on page 998
Converts numeric values to octal representation
Category: Numeric
Alignment: left
OCTAL w.
w
specifies the width of the output field.
Default: 3
Range: 1 “24
If necessary, the OCTAL w . format converts numeric values to integers before displaying them in octal representation.
OCTAL w . converts numeric values to octal representation. The $OCTAL w . format converts character values to octal representation.
put x octal6.;
When x = ... | The Result is ... |
---|---|
----+----1 | |
3592 | 007010 |
Writes data in packed decimal format
Category: Numeric
Alignment: left
See: PD w . d Format in the documentation for your operating environment.
PD w.d
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
optionally specifies to multiply the number by 10 d .
Different operating environments store packed decimal values in different ways. However, the PD w . d format writes packed decimal values with consistent results if the values are created in the same kind of operating environment that you use to run SAS.
The following table compares packed decimal notation in several programming languages:
Language | Notation |
---|---|
SAS | PD4. |
COBOL | COMP-3 PIC S9(7) |
IBM 370 assembler | PL4 |
PL/I | FIXED DEC |
y=put(x,pd4.); put y $hex8.;
When x = ... | The Result [*] is ... |
---|---|
----+----1 | |
128 | 00000128 |
[*] The result is a hexadecimal representation of a binary number written in packed decimal format. Each byte occupies one column of the output field. |
Writes packed Julian date values in the hexadecimal format yyyyddd F for IBM
Category: Date and Time
PDJULG w.
w
specifies the width of the output field.
Default: 4
Range: 3-16
The PDJULG w . format writes SAS date values in the form yyyyddd F, where
yyyy
is the two-byte representation of the four-digit Gregorian year.
ddd
is the one-and-a-half 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 belonging to the 100-year span that is defined by the YEARCUTOFF= system option.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
date = 17mar2005 d; juldate = put(date,pdjulg4.); put juldate $hex8.; | 2005076F |
Formats:
PDJULI w . Format on page 183
JULIAN w . Format on page 162
JULDAY w . Format on page 161
Functions:
JULDATE Function on page 614
DATEJUL Function on page 481
Informats:
PDJULI w . Informat on page 1003
PDJULG w . Informat on page 1001
JULIAN w . Informat on page 990
System Option:
YEARCUTOFF= System Option on page 1629
Writes packed Julian date values in the hexadecimal format ccyyddd F for IBM
Category: Date and Time
PDJULI w.
w
specifies the width of the output field.
Default: 4
Range: 3-16
The PDJULI w . format writes SAS date values in the form ccyyddd F, where
cc
is the one-byte representation of a two-digit integer that represents the century.
yy
is the one-byte representation of a two-digit integer that represents the year. The PDJULI w . format makes an adjustment for the century byte by subtracting 1900 from the 4 “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 one-and-a-half 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 belonging to the 100-year span that is defined by the YEARCUTOFF= system option.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
date = '17mar2005'd; juldate = put(date,pdjuli4.); put juldate $hex8.; | 0105076F |
date = '31dec2003'd; juldate = put(date,pdjuli4.); put juldate $hex8.; | 0103365F |
Formats:
PDJULG w . Format on page 182
JULIAN w . Format on page 162
JULDAY w . Format on page 161
Functions:
DATEJUL Function on page 481
JULDATE Function on page 614
Informats:
PDJULG w . Informat on page 1001
PDJULI w . Informat on page 1003
JULIAN w . Informat on page 990
System Option:
YEARCUTOFF= System Option on page 1629
Writes numeric values as percentages
Category: Numeric
Alignment: right
PERCENT w.d
w
specifies the width of the output field.
Default: 6
Range: 4 “32
d
optionally specifies the number of digits to the right of the decimal point in the numeric value.
Range: 0 “31
Requirement: must be less than w
The PERCENT w . d format multiplies values by 100, formats them the same as the BEST w . d format, and adds a percent sign (%) to the end of the formatted value, while it encloses negative values in parentheses. The PERCENT w . d format allows room for a percent sign and parentheses, even if the value is not negative.
put @10 gain percent10.;
When gain = ... | The Result is ... |
---|---|
0.1 1.2 0.05 | ----+----1----+----2 10% 120% (5%) |
Writes positive integer binary (fixed-point) values
Category: Numeric
Alignment: left
See: PIB w . d Format in the documentation for your operating environment.
PIB w . d
w
specifies the width of the output field.
Default: 1
Range: 1 “8
d
optionally specifies to multiply the number by 10 d .
All values are treated as positive. PIB w . 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.
Note: Different operating environments store integer binary values in different ways. This concept is called byte ordering. For a detailed discussion about byte ordering, see Byte Ordering for Integer Binary Data on Big Endian and Little Endian Platforms on page 75.
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 PIB w . d format treats all values as positive and includes the sign bit as part of the value.
The PIB w . d format 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 contain values between hexadecimal 80 and hexadecimal FF, where the high-order bit can be misinterpreted as a negative sign.
The PIB w . d format is the same as the IB w . d format except that PIB w . d treats all values as positive values.
The IB w . d and PIB w . d formats are used to write native format integers. (Native format allows you to read and write values that are created in the same operating environment.) The IBR w . d and PIBR w . 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 Table 3.1 on page 76.
To view a table that compares integer binary notation in several programming languages, see Table 3.2 on page 76.
y=put(x,pib1.); put y $hex2.;
When x = ... | The Result [*] is ... |
---|---|
----+----1 | |
12 | 0C |
[*] The result is a hexadecimal representation of a one-byte binary number written in positive integer binary format, which occupies one column of the output field. |
Format:
PIBR w . d Format on page 187
Writes positive integer binary (fixed-point) values in Intel and DEC formats
Category: Numeric
PIBR w . d
w
specifies the width of the input field.
Default: 1
Range: 1 “8
d
optionally specifies to multiply the number by 10 d .
All values are treated as positive. PIBR w . d writes positive integer binary values that have been generated by and for Intel and DEC operating environments. Use PIBR w . d to write positive integer binary data from Intel or DEC environments on other operating environments. The PIBR w . d format in SAS code allows for a portable implementation for writing the data in any operating environment.
Note: Different operating environments store positive integer binary values in different ways. This concept is called byte ordering. For a detailed discussion about byte ordering, see Byte Ordering for Integer Binary Data on Big Endian and Little Endian Platforms on page 75.
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 PIBR w . d format treats all values as positive and includes the sign bit as part of the value.
The PIBR w . d format 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 contain values between hexadecimal 80 and hexadecimal FF, where the high-order bit can be misinterpreted as a negative sign.
On Intel and DEC operating environments, the PIB w . d and PIBR w . d formats are equivalent.
The IB w . d and PIB w . d formats are used to write native format integers. (Native format allows you to read and write values that are created in the same operating environment.) The IBR w . d and PIBR w . 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 Table 3.1 on page 76.
To view a table that compares integer binary notation in several programming languages, see Table 3.2 on page 76.
y=put(x,pibr2.); put y $hex4.;
When x = ... | The Result [*] is ... |
---|---|
----+----1 | |
128 | 8000 |
[*] 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. |
Informat:
PIB w . d Informat on page 1006
Writes data in unsigned packed decimal format
Category: Numeric
Alignment: left
PK w.d
w
specifies the width of the output field.
Default: 1
Range: 1 “16
d
optionally specifies to multiply the number by 10 d .
Requirement: must be less than w
Each byte of unsigned packed decimal data contains two digits.
The PK w . d format is similar to the PD w . d format except that PK w . d does not write the sign in the low-order byte.
y=put(x,pk4.); put y $hex8.;
When x = ... | The Result [*] is ... |
---|---|
----+----1 | |
128 | 00000128 |
[*] The result is a hexadecimal representation of a four-byte number written in packed decimal format. Each byte occupies one column of the output field. |
Writes p -values
Category: Numeric
Alignment: right
PVALUE w.d
w
specifies the width of the output field.
Default: 6
Range: 3 “32
d
optionally specifies the number of digits to the right of the decimal point in the numeric value.
Default: the minimum of 4 and w “2
Restriction: must be less than w
The PVALUE w . d format follows the rules for the w . d format, except that
if the value x is such that 0 <= x < 10 -d , x prints as <.0...01 with d -1 zeros
missing values print as . unless you specify a different character by using the MISSING= system option
put x pvalue6.4;
When x = ... | The Result is ... |
---|---|
----+----1 | |
.05 | 0.0500 |
0.000001 | < .0001 |
| < .0001 |
.0123456 | 0.0123 |
Writes date values as the quarter of the year
Category: Date and Time
Alignment: right
QTR w.
w
specifies the width of the output field.
Default: 1
Range: 1 “32
The example table uses the input value of 16500, which is the SAS date value that corresponds to March 5, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
put date qtr.; | 1 |
Format:
QTRR w . Format on page 192
Writes date values as the quarter of the year in Roman numerals
Category: Date and Time
Alignment: right
QTRR w.
w
specifies the width of the output field.
Default: 3
Range: 3 “32
The example table uses the input value of 16694, which is the SAS date value that corresponds to September 15, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
put date qtrr.; | III |
Format:
QTR w . Format on page 191
Writes real binary data (floating-point) in real binary format
Category: Numeric
Alignment: left
See: RB w . d Format in the documentation for your operating environment.
RB w . d
w
specifies the width of the output field.
Default: 4
Range: 2 “8
d
optionally specifies to multiply the number by 10 d .
The RB w . d format writes numeric data in the same way that SAS stores them. Because it requires no data conversion, RB w . d is the most efficient method for writing data with SAS.
Note: Different operating environments store real binary values in different ways. However, RB w . d writes real binary values with consistent results in the same kind 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 eight-byte (double-precision) number rather than a true four-byte (single-precision) floating-point number.
The following table compares the names of real binary notation in several programming languages:
Language | 4 Bytes | 8 Bytes |
---|---|---|
SAS | RB4. | RB8. |
FORTRAN | REAL*4 | REAL*8 |
C | float | double |
COBOL | COMP-1 | COMP-2 |
IBM 370 assembler | E | D |
y=put(x,rb8.); put y $hex16.;
When x = ... | The Result [*] is ... |
---|---|
----+---1----+----2 | |
128 | 4280000000000000 |
[*] The result is a hexadecimal representation of an eight-byte real binary number as it looks on an IBM mainframe. Each byte occupies one column of the output field. |
Writes numeric values as roman numerals
Category: Numeric
Alignment: left
ROMAN w.
w
specifies the width of the output field.
Default: 6
Range: 2 “32
The ROMAN w . format truncates a floating-point value to its integer component before the value is written.
put @5 year roman10.;
When year = ... | The Result is ... |
---|---|
1998 | MCMXCVIII |
Writes native standard numeric data in IBM mainframe format
Category: Numeric
S370FF w.d
w
specifies the width of the output field.
Default: 12
Range: 1 “32
d
optionally specifies the power of 10 by which to divide the value.
Range: 0 “31
The S370FF w . d format writes numeric data in IBM mainframe format (EBCDIC). The EBCDIC numeric values are represented with one byte per digit. If EBCDIC is the native format, S370FF w . d performs no conversion.
If a value is negative, an EBCDIC minus sign precedes the value. A missing value is represented as a single EBCDIC period.
On an EBCDIC system, S370FF w . d behaves like the w . d format.
On all other systems, S370FF w . d performs the same role for numeric data that the $EBCDIC w . format does for character data.
y=put(x,s370ff5.); put y $hex10.;
When x= ... | The Result [*] is ... |
---|---|
----+----1 | |
12345 | F1F2F3F4F5 |
[*] The result is the hexadecimal representation for the integer. |
Formats:
$EBCDIC w . Format on page 96
w . d Format on page 215
Writes integer binary (fixed-point) values, including negative values, in IBM mainframe format
Category: Numeric
Alignment: left
S370FIB w . d
w
specifies the width of the output field.
Default: 4
Range: 1 “8
d
optionally specifies to multiply the number by 10 d .
The S370FIB w . 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. S370FIB w . 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 S370FIB w . d to write integer binary data in IBM mainframe format from data that are created in other operating environments.
Note: Different operating environments store integer binary values in different ways. This concept is called byte ordering. For a detailed discussion about byte ordering, see Byte Ordering for Integer Binary Data on Big Endian and Little Endian Platforms on page 75.
If you use SAS on an IBM mainframe, S370FIB w . d and IB w . d are identical.
S370FPIB w . d , S370FIBU w . d , and S370FIB w . 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 Table 3.1 on page 76.
To view a table that compares integer binary notation in several programming languages, see Table 3.2 on page 76.
y=put(x,s370fib4.); put y $hex8.;
When x = ... | The Result [*] is ... |
---|---|
----+----1 | |
128 | 00000080 |
[*] The result is a hexadecimal representation of a 4-byte integer binary number. Each byte occupies one column of the output field. |
Formats:
S370FIBU w . d Format on page 197
S370FPIB w . d Format on page 201
Writes unsigned integer binary (fixed-point) values in IBM mainframe format
Category: Numeric
Alignment: left
S370FIBU w . d
w
specifies the width of the output field.
Default: 4
Range: 1 “8
d
optionally specifies to multiply the number by 10 d .
The S370FIBU w . 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. S370FIBU w . 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 S370FIBU w . d to write unsigned integer binary data in IBM mainframe format from data that are created in other operating environments.
Note: Different operating environments store integer binary values in different ways. This concept is called byte ordering. For a detailed discussion about byte ordering, see Byte Ordering for Integer Binary Data on Big Endian and Little Endian Platforms on page 75.
The S370FIBU w . d format is equivalent to the COBOL notation PIC 9( n ) BINARY, where n is the number of digits.
The S370FIBU w . d format is the same as the S370FIB w . d format except that the S370FIBU w . d format always uses the absolute value instead of the signed value.
The S370FPIB w . d format writes all negative numbers as FFs, while the S370FIBU w . d format writes the absolute value.
S370FPIB w . d , S370FIBU w . d , and S370FIB w . 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 Table 3.1 on page 76.
To view a table that compares integer binary notation in several programming languages, see Table 3.2 on page 76.
y=put(x,s370fibu1.); put y $hex2.;
When x = ... | The Result [*] is ... |
---|---|
245 | F5 |
ˆ’ 245 | F5 |
[*] The result is a hexadecimal representation of a one-byte integer binary number. Each byte occupies one column of the output field. |
Formats:
S370FIB w . d Format on page 196
S370FPIB w . d Format on page 201
Writes packed decimal data in IBM mainframe format
Category: Numeric
Alignment: left
S370FPD w.d
w
specifies the width of the output field.
Default: 1
Range: 1 “16
d
optionally specifies to multiply the number by 10 d .
Use S370FPD w . d in other operating environments to write packed decimal data in the same format as on an IBM mainframe computer.
The following table shows the notation for equivalent packed decimal formats in several programming languages:
Language | Packed Decimal Notation |
---|---|
SAS | S370FPD4. |
PL/I | FIXED DEC(7,0) |
COBOL | COMP-3 PIC S9(7) |
IBM 370 assembler | PL4 |
y=put(x,s370fpd4.); put y $hex8.;
When x = ... | The Result [*] is ... |
---|---|
----+----1 | |
128 | 0000128C |
[*] The result is a hexadecimal representation of a binary number written in packed decimal format. Each byte occupies one column of the output field. |
Writes unsigned packed decimal data in IBM mainframe format
Category: Numeric
Alignment: left
S370FPDU w . d
w
specifies the width of the output field.
Default: 1
Range: 1 “16
d
optionally specifies to multiply the number by 10 d .
Use S370FPDU w . d in other operating environments to write unsigned packed decimal data in the same format as on an IBM mainframe computer.
The S370FPDU w . d format is similar to the S370FPD w . d format except that the S370FPD w . d format always uses the absolute value instead of the signed value.
The S370FPDU w . d format is equivalent to the COBOL notation PIC 9( n ) PACKED-DECIMAL, where the n value is the number of digits.
y=put(x,s370fpdu2.); put y $hex4.;
When x = ... | The Result [*] is ... |
---|---|
123 | 123F |
ˆ’ 123 | 123F |
[*] The result is a hexadecimal representation of a binary number written in packed decimal format. Each two hexadecimal digits correspond to one byte of binary data, and each byte corresponds to one column of the output field. |
Writes positive integer binary (fixed-point) values in IBM mainframe format
Category: Numeric
Alignment: left
S370FPIB w . d
w
specifies the width of the output field.
Default: 4
Range: 1 “8
d
optionally specifies to multiply the number by 10 d .
Positive integer binary values are the same as integer binary values, except that all values are treated as positive. S370FPIB w . 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 S370FPIB w . d to write positive integer binary data in IBM mainframe format from data that are created in other operating environments.
Note: Different operating environments store integer binary values in different ways. This concept is called byte ordering. For a detailed discussion about byte ordering, see Byte Ordering for Integer Binary Data on Big Endian and Little Endian Platforms on page 75.
If you use SAS on an IBM mainframe, S370FPIB w . d and PIB w . d are identical.
The S370FPIB w . d format is the same as the S370FIB w . d format except that the S370FPIB w . d format treats all values as positive values.
S370FPIB w . d , S370FIBU w . d , and S370FIB w . 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 Table 3.1 on page 76.
To view a table that compares integer binary notation in several programming languages, see Table 3.2 on page 76.
y=put(x,s370fpib1.); put y $hex2.;
When x = ... | The Result [*] is ... |
---|---|
----+----1 | |
12 | 0C |
[*] The result is a hexadecimal representation of a one-byte binary number written in positive integer binary format, which occupies one column of the output field. |
Formats:
S370FIB w . d Format on page 196
S370FIBU w . d Format on page 197
Writes real binary (floating-point) data in IBM mainframe format
Category: Numeric
Alignment: left
S370FRB w . d
w
specifies the width of the output field.
Default: 6
Range: 2 “8
d
optionally specifies to multiply the number by 10 d .
A floating-point value consists of two parts : a mantissa that gives the value and an exponent that gives the value s magnitude.
Use S370FRB w . d in other operating environments to write floating-point binary data in the same format as on an IBM mainframe computer.
The following table shows the notation for equivalent floating-point formats in several programming languages:
Language | 4 Bytes | 8 Bytes |
---|---|---|
SAS | S370FRB4. | S370FRB8. |
PL/I | FLOAT BIN(21) | FLOAT BIN(53) |
FORTRAN | REAL*4 | REAL*8 |
COBOL | COMP-1 | COMP-2 |
IBM 370 assembler | E | D |
C | float | double |
y=put(x,s370frb6.); put y $hex8.;
When x = ... | The Result [*] is ... |
---|---|
128 | 42800000 |
ˆ’ 123 | C2800000 |
[*] The result is a hexadecimal representation of a binary number in zoned decimal format on an IBM mainframe computer. Each two hexadecimal digits correspond to one byte of binary data, and each byte corresponds to one column of the output field. |
Writes zoned decimal data in IBM mainframe format
Category: Numeric
Alignment: left
S370FZD w . d
w
specifies the width of the output field.
Default: 8
Range: 1 “32
d
optionally specifies to multiply the number by 10 d .
Use S370FZD w . d in other operating environments to write zoned decimal data in the same format as on an IBM mainframe computer.
The following table shows the notation for equivalent zoned decimal formats in several programming languages:
Language | Zoned Decimal Notation |
---|---|
SAS | S370FZD3. |
PL/I | PICTURE 99T |
COBOL | PIC S9(3) DISPLAY |
assembler | ZL3 |
y=put(x,s370fzd3.); put y $hex6.;
When x = ... | The Result [*] is ... |
---|---|
123 | F1F2C3 |
ˆ’ 123 | F1F2D3 |
[*] The result is a hexadecimal representation of a binary number in zoned decimal format on an IBM mainframe computer. Each two hexadecimal digits correspond to one byte of binary data, and each byte corresponds to one column of the output field. |
Writes zoned decimal leading “sign data in IBM mainframe format
Category: Numeric
Alignment: left
S370FZDL w . d
w
specifies the width of the output field.
Default: 8
Range: 1 “32
d
optionally specifies to multiply the number by 10 d .
Use S370FZDL w . d in other operating environments to write zoned decimal leading-sign data in the same format as on an IBM mainframe computer.
The S370FZDL w . d format is similar to the S370FZD w . d format except that the S370FZDL w . d format displays the sign of the number in the first byte of the formatted output.
The S370FZDL w . d format is equivalent to the COBOL notation PIC S9( n ) DISPLAY SIGN LEADING, where the n value is the number of digits.
y=put(x,s370fzdl3.); put y $hex6.;
When x = ... | The Result [*] is ... |
---|---|
123 | C1F2F3 |
ˆ’ 123 | D1F2F3 |
[*] The result is a hexadecimal representation of a binary number in zoned decimal format on an IBM mainframe computer. Each two hexadecimal digits correspond to one byte of binary data, and each byte corresponds to one column of the output field. |
Writes zoned decimal separate leading-sign data in IBM mainframe format
Category: Numeric
Alignment: left
S370FZDS w . d
w
specifies the width of the output field.
Default: 8
Range: 2 “32
d
optionally specifies to multiply the number by 10 d .
Use S370FZDS w . d in other operating environments to write zoned decimal separate leading-sign data in the same format as on an IBM mainframe computer.
The S370FZDS w . d format is similar to the S370FZDL w . d format except that the S370FZDS w . d format does not embed the sign of the number in the zoned output.
The S370FZDS w . d format is equivalent to the COBOL notation PIC S9( n ) DISPLAY SIGN LEADING SEPARATE, where the n value is the number of digits.
y=put (x,s370fzds4.); put y $hex8.;
When x = ... | The Result [*] is ... |
---|---|
123 | 4EF1F2F3 |
ˆ’ 123 | 60F1F2F3 |
[*] The result is a hexadecimal representation of a binary number in zoned decimal format on an IBM mainframe computer. Each two hexadecimal digits correspond to one byte of binary data, and each byte corresponds to one column of the output field. |
Writes zoned decimal separate trailing-sign data in IBM mainframe format
Category: Numeric
Alignment: left
S370FZDT w . d
w
specifies the width of the output field.
Default: 8
Range: 2 “32
d
optionally specifies to multiply the number by 10 d .
Use S370FZDT w . d in other operating environments to write zoned decimal separate trailing-sign data in the same format as on an IBM mainframe computer.
The S370FZDT w . d format is similar to the S370FZDS w . d format except that the S370FZDT w . d format displays the sign of the number at the end of the formatted output.
The S370FZDT w . d format is equivalent to the COBOL notation PIC S9( n ) DISPLAY SIGN TRAILING SEPARATE, where the n value is the number of digits.
y=put (x,s370fzdt4.); ; put y $hex8.;
When x = ... | The Result [*] is |
---|---|
123 | F1F2F34E |
ˆ’ 123 | F1F2F360 |
[*] The result is a hexadecimal representation of a binary number in zoned decimal format on an IBM mainframe computer. Each two hexadecimal digits correspond to one byte of binary data, and each byte corresponds to one column of the output field. |
Writes unsigned zoned decimal data in IBM mainframe format
Category: Numeric
Alignment: left
S370FZDU w . d
w
specifies the width of the output field.
Default: 8
Range: 1 “32
d
optionally specifies to multiply the number by 10 d .
Use S370FZDU w . d in other operating environments to write unsigned zoned decimal data in the same format as on an IBM mainframe computer.
The S370FZDU w . d format is similar to the S370FZD w . d format except that the S370FZDU w . d format always uses the absolute value of the number.
The S370FZDU w . d format is equivalent to the COBOL notation PIC 9( n ) DISPLAY, where the n value is the number of digits.
y=put (x,s370fzdu3.); put y $hex6.;
When x = ... | The Result [*] is ... |
---|---|
123 | F1F2F3 |
ˆ’ 123 | F1F2F3 |
[*] The result is a hexadecimal representation of a binary number in zoned decimal format on an IBM main frame computer. Each pair of hexadecimal digits (such as F1) corresponds to one byte of binary data, and each byte corresponds to one column of the output field. |
Writes Social Security numbers
Category: Numeric
Alignment: none
SSN w.
w
specifies the width of the output field.
Default: 11
Restriction: w must be 11
If the value is missing, SAS writes nine single periods with dashes 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.
put id ssn11.;
When id = ... | The Result is ... |
---|---|
----+----1----+ | |
263878439 | 263-87-8439 |
Writes time values as hours, minutes, and seconds in the form hh:mm:ss.ss
Category: Date and Time
Alignment: right
TIME w.d
w
specifies the width of the output field.
Default: 8
Range: 2 “20
Tip: Make w large enough to produce the desired results. To obtain a complete time value with three decimal places, you must allow at least 12 spaces: 8 spaces to the left of the decimal point, 1 space for the decimal point itself, and 3 spaces for the decimal fraction of seconds.
d
optionally specifies the number of digits to the right of the decimal point in the seconds value.
Requirement: must be less than w
Range: 1 “19
The TIME w . d format writes SAS time values in the form hh:mm:ss.ss , where
hh
is an integer.
Note:
If hh is a single digit, TIME w . d places a leading blank before the digit. For example, the TIME w.d. format writes 9:00 instead of 09:00.
mm
is the number of minutes, ranging from 00 through 59.
ss.ss
is the number of seconds, ranging from 00 through 59, with the fraction of a second following the decimal point.
The TIME w . d format is similar to the HHMM w . d format except that TIME w . d includes seconds.
The example table uses the input value of 59083, which is the SAS time value that corresponds to 4:24:43 PM.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
put begin time.; | 16:24:43 |
Formats:
HHMM w . d Format on page 155
HOUR w . d Format on page 156
MMSS w . d Format on page 167
Functions:
HOUR Function on page 579
MINUTE Function on page 647
SECOND Function on page 819
TIME Function on page 855
Informat:
TIME w . Informat on page 1035
Writes time values as hours, minutes, and seconds in the form hh:mm:ss.ss with AM or PM
Category: Date and Time
Alignment: right
TIMEAMPM w.d
w
specifies the width of the output field.
Default: 11
Range: 2 “20
d
optionally specifies the number of digits to the right of the decimal point in the seconds value.
Requirement: must be less than w
Range: 1 “19
The TIMEAMPM w . d format writes SAS time values in the form hh:mm:ss.ss with AM or PM, where
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.
The TIMEAMPMM w . d format is similar to the TIMEM w . d format except, that TIMEAMPMM w . d prints AM or PM at the end of the time.
TIME w . d writes hours greater than 23:59:59 PM, and TIMEAMPM w . d does not.
The example table uses the input value of 59083, which is the SAS time value that corresponds to 4:24:43 PM.
When the SAS Statement is ... | The Result is ... |
---|---|
put begin timeampm3.; put begin timeampm5.; put begin timeampm7.; put begin timeampm11.; | ----+----1----+ PM 4 PM 4:24 PM 4:24:43 PM |
Format:
TIME w . d Format on page 210
Writes the time portion of datetime values in the form hh:mm:ss.ss
Category: Date and Time
Alignment: right
TOD w.d
w
specifies the width of the output field.
Default: 8
Range: 2 “20
d
optionally specifies the number of digits to the right of the decimal point in the seconds value.
Requirement: must be less than w
Range: 1 “19
The TOD w . d format writes SAS datetime values in the form hh:mm:ss.ss , where
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.
The example table uses the input value of 1472049623, which is the SAS datetime value that corresponds to August 24, 2006, at 2:20:23 PM.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
put begin tod9.2; | 14:20:23 |
Formats:
TIME w . d Format on page 210
TIMEAMPM w . d Format on page 212
Function:
TIMEPART Function on page 855
Informat:
TIME w . Informat on page 1035
Writes real binary (floating-point) data in VMS format
Category: Numeric
Alignment: right
VAXRB w . d
w
specifies the width of the output field.
Default: 4
Range: 2-8
d
optionally specifies the power of 10 by which to divide the value.
Use the VAXRB w . d format to write data in native VAX/VMS floating-point notation.
If you use SAS that is running under VAX/VMS, then the VAXRB w . d and the RB w . d formats are identical.
x=1; y=put(x,vaxrb8.); put y=$hex16.;
When x= ... | The result [*] is ... |
---|---|
----+----1 | |
1 | 8040000000000000 |
[*] The result is the hexadecimal representation for the integer. |
Writes standard numeric data one digit per byte
Category: Numeric
Alignment: right
Alias: F w . d
See: w . d Format in the documentation for your operating environment.
w . d
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
optionally specifies the number of digits to the right of the decimal point in the numeric value.
Range: 0 “31
Requirement: must be less than w
Tip: If d is 0 or you omit d , w . d writes the value without a decimal point.
The w . d format rounds to the nearest number that fits in the output field. If w . d is too small, SAS may shift the decimal to the BEST w . 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.
The Z w . d format is similar to the w . d format except that Z w . d pads right-aligned output with 0s instead of blanks.
put @7 x 6.3;
When x = ... | The Result is ... |
---|---|
----+----1----+ | |
23.45 | 23.450 |
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 and Time
Alignment: right
WEEKDATE w.
w
specifies the width of the output field.
Default: 29
Range: 3 “37
The WEEKDATE w . format writes SAS date values in the form day-of-week , month-name dd , yy (or yyyy ), where
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.
The WEEKDATE w . format is the same as the WEEKDATX w . format except that WEEKDATX w . prints dd before the month s name.
The example table uses the input value of 16601 which is the SAS date value that corresponds to June 14, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+----2 | |
put date weekdate3.; | Tue |
put date weekdate9.; | Tuesday |
put date weekdate15.; | Tue, Jun 14, 05 |
put date weekdate17.; | Tue, Jun 14, 2005 |
Formats:
DATE w . Format on page 118
DDMMYY w . Format on page 124
MMDDYY w . Format on page 163
TOD w.d Format on page 213
WEEKDATX w . Format on page 218
YYMMDD w . Format on page 230
Functions:
JULDATE Function on page 614
MDY Function on page 643
WEEKDAY Function on page 914
Informats:
DATE w . Informat on page 977
DDMMYY w . Informat on page 980
MMDDYY w . Informat on page 991
YYMMDD w . Informat on page 1042
Writes date values as the day of the week and date in the form day-of-week , dd month-name yy (or yyyy )
Category: Date and Time
Alignment: right
WEEKDATX w.
w
specifies the width of the output field.
Default: 29
Range: 3 “37
The WEEKDATX w . format writes SAS date values in the form day-of-week , dd month-name , yy (or yyyy ), where
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.
The WEEKDATE w . format is the same as the WEEKDATX w . format except that WEEKDATE w . prints dd after the month s name.
The WEEKDATX w . format is the same as the DTWKDATX w . format, except that DTWKDATX w . expects a datetime value as input.
The example table uses the input value of 16490 which is the SAS date value that corresponds to February 23, 2005.
When the SAS statement is ... | The result is ... |
---|---|
----+----1----+----2----+----3 | |
put date weekdatx.; | Wednesday, 23 February 2005 |
Formats:
DTWKDATX w . Format on page 133
DATE w . Format on page 118
DDMMYY w . Format on page 124
MMDDYY w . Format on page 163
TOD w.d Format on page 213
WEEKDATE w . Format on page 217
YYMMDD w . Format on page 230
Functions:
JULDATE Function on page 614
MDY Function on page 643
WEEKDAY Function on page 914
Informats:
DATE w . Informat on page 977
DDMMYY w . Informat on page 980
MMDDYY w . Informat on page 991
YYMMDD w . Informat on page 1042
Writes date values as the day of the week
Category: Date and Time
Alignment: right
WEEKDAY w.
w
specifies the width of the output field.
Default: 1
Range: 1 “32
The WEEKDAY w . format writes a SAS date value as the day of the week (where 1=Sunday, 2=Monday, and so on).
The example table uses the input value of 16469, which is the SAS date value that corresponds to February 2, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
put date weekday.; | 4 |
Format:
DOWNAME w . Format on page 130
Writes a week number in decimal format by using the U algorithm
Category: Date and Time
See: The WEEKU format in SAS National Language Support (NLS): User s Guide
Writes a week number in decimal format by using the V algorithm
Category: Date and Time
See: The WEEKV WEEKV w . Informat on page 1041 format in SAS National Language Support (NLS): User s Guide
Reads the format of the number-of-week value within the year and returns a SAS-date value using the W algorithm
Category: Date and Time
See: The WEEKW format in SAS National Language Support (NLS): User s Guide
Writes date values as the name of the month, the day, and the year in the form month-name dd , yyyy
Category: Date and Time
Alignment: right
WORDDATE w.
w
specifies the width of the output field.
Default: 18
Range: 3 “32
The WORDDATE w . format writes SAS date values in the form month-name dd , yyyy , where
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.
The WORDDATE w . format is the same as the WORDDATX w . format except that WORDDATX w . prints dd before the month s name.
The example table uses the input value of 16601, which is the SAS date value that corresponds to June 14, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+----2 | |
put term worddate3.; put term worddate9.; put term worddate12.; put term worddate20.; | Jun June Jun 14, 2005 June 14, 2005 |
Format:
WORDDATX w . Format on page 222
Writes date values as the day, the name of the month, and the year in the form dd month-name yyyy
Category: Date and Time
Alignment: right
WORDDATX w.
w
specifies the width of the output field.
Default: 18
Range: 3 “32
The WORDDATX w . format writes SAS date values in the form dd month-name , yyyy , where
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.
The WORDDATX w . format is the same as the WORDDATE w . format except that WORDDATE w . prints dd after the month s name.
The example table uses the input value of 16500, which is the SAS date value that corresponds to March 5, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+----2 | |
put term worddatx.; | 05 March 2005 |
Format:
WORDDATE w . Format on page 221
Writes numeric values as words with fractions that are shown numerically
Category: Numeric
Alignment: left
WORDF w.
w
specifies the width of the output field.
Default: 10
Range: 5 “32767
The WORDF w . format converts numeric values to their equivalent in English words, with fractions that are represented numerically in hundredths. For example, 8.2 prints as eight and 20/100.
Negative numbers are preceded by the word minus. When the value s equivalent in words does not fit into the specified field, it is truncated on the right and the last character prints as an asterisk.
The WORDF w . format is similar to the WORDS w . format except that WORDF w . prints fractions as numbers instead of words.
put price wordf15.;
When price = ... | The Result is ... |
---|---|
----+----1----+ | |
2.5 | two and 50/100 |
Format:
WORDS w . Format on page 225
Writes numeric values as words
Category: Numeric
Alignment: left
WORDS w.
w
specifies the width of the output field.
Default: 10
Range: 5 “32767
You can use the WORDS w . format to print checks with the amount written out below the payee line.
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 prints as five and thirty hundredths. When the value s equivalent in words does not fit into the specified field, it is truncated on the right and the last character prints as an asterisk.
The WORDS w . format is similar to the WORDF w . format except that WORDS w . prints fractions as words instead of numbers.
put price words23.;
When price = ... | The Result is ... |
---|---|
----+----1----+----2----+ | |
2.1 | two and ten hundredths |
Format:
WORDF w . Format on page 224
Writes date values as the year
Category: Date and Time
Alignment: right
YEAR w.
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 print; otherwise, the year value prints as four digits.
The YEAR w . format is similar to the DTYEAR w . format in that they both write date values. The difference is that YEAR w . expects a SAS date value as input, and DTYEAR w . expects a datetime value.
The example table uses the input value of 16601, which is the SAS date value that corresponds to June 14, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
put date year2.; | 05 |
put date year4.; | 2005 |
Format:
DTYEAR w . Format on page 134
Writes numeric values with yen signs, commas, and decimal points
Category: Numeric
Alignment: right
See: The YEN format in SAS National Language Support (NLS): User s Guide
Writes date values in the form < yy > yy M mm , where M is the separator and the year appears as either 2 or 4 digits
Category: Date and Time
Alignment: right
YYMM w.
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.
The YYMM w . format writes SAS date values in the form < yy > yy M mm , where
yy > yy
is a two-digit or four-digit integer that represents the year.
M
is the character separator.
mm
is an integer that represents the month.
The following examples use the input value of 16734, which is the SAS date value that corresponds to October 25, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+ | |
put date yymm5.; put date yymm6.; put date yymm.; put date yymm7.; put date yymm10.; | 05M10 05M10 2005M10 2005M10 2005M10 |
Format:
MMYY w . Format on page 168
YYMM xw . Format on page 228
Writes date values in the form < yy > yymm or < yy > yy X mm , where X represents a specified separator and the year appears as either 2 or 4 digits
Category: Date and Time
Alignment: right
YYMM xw.
x
identifies a separator or specifies that no separator appear between the year and the month. Valid values for x are:
C
separates with a colon
D
separates with a dash
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
Interaction: When x is set to N , no separator is specified. The width range is then 4 “32, and the default changes to 6.
Interaction: When x has a value of C, D, P, or S and 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.
Interaction: When x has a value of N and w has a value of 4 or 5, the date appears with only the last two digits of the year. When x has a value of N and w is 6 or more, the date appears with a four-digit year.
The YYMM xw . format writes SAS date values in the form < yy > yymm or < yy > yy X mm , where
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.
The following examples use the input value of 16631, which is the SAS date value that corresponds to July 14, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+ | |
put date yymmc5.; put date yymmd.; put date yymmn4.; put date yymmp8.; put date yymms10.; | 05:07 2005-07 0507 2005.07 2005/07 |
Format:
MMYY xw . Format on page 169
YYMM w . Format on page 227
Writes date values in the form < yy > yymmdd or < yy > yy “ mm “ dd , where a dash is the separator and the year appears as either 2 or 4 digits
Category: Date and Time
Alignment: right
YYMMDD w.
w
specifies the width of the output field.
Default: 8
Range: 2 “10
Interaction: When w has a value of 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 dashes.
The YYMMDD w . format writes SAS date values in the form < yy > yymmdd or < yy > yy “ mm “ dd , where
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.
The following examples use the input value of 16529, which is the SAS date value that corresponds to April 3, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+ | |
put day yymmdd2.; | 05 |
put day yymmdd3.; | 05 |
put day yymmdd4.; | 0504 |
put day yymmdd5.; | 05-04 |
put day yymmdd6.; | 050403 |
put day yymmdd7.; | 050403 |
put day yymmdd8.; | 05-04-03 |
put day yymmdd10.; | 2005-04-03 |
Formats:
DATE w . Format on page 118
DDMMYY w . Format on page 124
MMDDYY w . Format on page 163
YYMMDD xw . Format on page 231
Functions:
DAY Function on page 483
MDY Function on page 643
MONTH Function on page 655
YEAR Function on page 914
Informats:
DATE w . Informat on page 977
DDMMYY w . Informat on page 980
MMDDYY w . Informat on page 991
Writes date values in the form < yy > yymmdd or < yy > yy X mm X dd , where X represents a specified separator and the year appears as either 2 or 4 digits
Category: Date and Time
Alignment: right
YYMMDD xw.
x
identifies a separator or specifies that no separator appear between the year, the month, and the day. Valid values for x are:
B
separates with a blank
C
separates with a colon
D
separates with a dash
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
Interaction: When w has a value of 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.
Interaction: When x has a value of N, the width range is 2 “8.
The YYMMDD xw . format writes SAS date values in the form < yy > yymmdd or < yy > yy X mm X dd , where
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.
The following examples use the input value of 16731, which is the SAS date value that corresponds to October 22, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+ | |
put day yymmddc5.; | 05:10 |
put day yymmddd8.; | 05-10-22 |
put day yymmddp10.; | 2005.10.22 |
put day yymmddn8.; | 20051022 |
Formats:
DATE w . Format on page 118
DDMMYY xw . Format on page 125
MMDDYY xw . Format on page 165
YYMMDD w . Format on page 230
Functions:
DAY Function on page 483
MDY Function on page 643
MONTH Function on page 655
YEAR Function on page 914
Informat:
YYMMDD w . Informat on page 1042
Writes date values in the form yymmm or yyyymmm
Category: Date and Time
Alignment: right
YYMON w.
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
The YYMON w . format abbreviates the month s name to three characters.
The example table uses the input value of 16601, which is the SAS date value that corresponds to June 14, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1 | |
put date yymon6.; | 05JUN |
put date yymon7.; | 2005JUN |
Format:
MMYY w . Format on page 168
Writes date values in the form < yy > yy Q q , where Q is the separator, the year appears as either 2 or 4 digits, and q is the quarter of the year
Category: Date and Time
Alignment: right
YYQ w.
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.
The YYQ w . format writes SAS date values in the form < yy > yy Q q , where
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.
The following examples use the input value of 16601, which is the SAS date value that corresponds to June 14, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+ | |
put date yyq4.; | 05Q2 |
put date yyq5.; | 05Q2 |
put date yyq.; | 2005Q2 |
put date yyq6.; | 2005Q2 |
put date yyq10.; | 2005Q2 |
Formats:
YYQ xw . Format on page 235
YYQR w . Format on page 237
Writes date values in the form < yy > yyq or < yy > yy X q , where X represents a specified separator, the year appears as either 2 or 4 digits, and q is the quarter of the year
Category: Date and Time
Alignment: right
YYQ xw.
x
identifies a separator or specifies that no separator appear between the year and the quarter. Valid values for x are:
C
separates with a colon
D
separates with a dash
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
Interaction: When x is set to N , no separator is specified. The width range is then 3 “32, and the default changes to 5.
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.
Interaction: When x has a value of N and w has a value of 3 or 4, the date appears with only the last two digits of the year. When x has a value of N and w is 5 or more, the date appears with a four-digit year.
The YYQ xw . format writes SAS date values in the form < yy > yyq or < yy > yy X q , where
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.
The following examples use the input value of 16631, which is the SAS date value that corresponds to July 14, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+ | |
put date yyqc4.; | 05:3 |
put date yyqd.; | 2005-3 |
put date yyqn3.; | 053 |
put date yyqp6.; | 2005.3 |
put date yyqs8.; | 2005/3 |
Formats:
YYQ w . Format on page 234
YYQR xw . Format on page 238
Writes date values in the form < yy > yy Q qr , where Q is the separator, the year appears as either 2 or 4 digits, and qr is the quarter of the year expressed in roman numerals
Category: Date and Time
Alignment: right
YYQR w.
w
specifies the width of the output field.
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.
The YYQR w . format writes SAS date values in the form < yy > yy Q qr , where
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.
The following examples use the input value of 16601, which is the SAS date value that corresponds to June 14, 2005.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+ | |
put date yyqr6.; put date yyqr7.; put date yyqr.; put date yyqr8.; put date yyqr10.; | 05QII 2005QII 2005QII 2005QII 2005QII |
Format:
YYQ w . Format on page 234
YYQR xw . Format on page 238
Writes date values in the form < yy > yyqr or < yy > yy X qr , where X represents a specified separator, the year appears as either 2 or 4 digits, and qr is the quarter of the year expressed in Roman numerals
Category: Date and Time
Alignment: right
YYQR xw.
x
identifies a separator or specifies that no separator appear between the year and the quarter. Valid values for x are:
C
separates with a colon
D
separates with a dash
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
Interaction: When x is set to N , no separator is specified. The width range is then 5 “32, and the default changes to 7.
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.
The YYQR xw . format writes SAS date values in the form < yy > yyqr or < yy > yy X qr , where
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.
The following examples use the input value of 16431, which is the SAS date value that corresponds to December 24, 2004.
When the SAS Statement is ... | The Result is ... |
---|---|
----+----1----+ | |
put date yyqrc6.; put date yyqrd.; put date yyqrn5.; put date yyqrp8.; put date yyqrs10.; | 04:IV 2004-IV 04IV 2004.IV 2004/IV |
Format:
YYQ xw . Format on page 235
YYQR w . Format on page 237
Writes standard numeric data with leading 0s
Category: Numeric
Alignment: right
Z w.d
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
optionally specifies the number of digits to the right of the decimal point in the numeric value.
Range: 0 “31
Tip: If d is 0 or you omit d , Z w . d writes the value without a decimal point.
The Z w . d format writes standard numeric values one digit per byte and fills in 0s to the left of the data value.
The Z w . d format rounds to the nearest number that will fit in the output field. If w . d is too large to fit, SAS might shift the decimal to the BEST w . format. The Z w . d format writes negative numbers with leading minus signs. In addition, it right aligns before writing and pads the output with leading zeros.
The Z w . d format is similar to the w.d format except that Z w . d pads right-aligned output with 0s instead of blanks.
put @5 seqnum z8.;
When seqnum = ... | The Result is ... |
---|---|
----+----1 | |
1350 | 00001350 |
Writes numeric data in zoned decimal format
Category: Numeric
Alignment: left
See: ZD w . d Format in the documentation for your operating environment.
ZD w . d
w
specifies the width of the output field.
Default: 1
Range: 1 “32
d
optionally specifies to multiply the number by 10 d .
The zoned decimal format is similar to standard numeric format in that every digit requires one byte. However, the value s sign is in the last byte, along with the last digit.
Note: Different operating environments store zoned decimal values in different ways. However, the ZD w . d format writes zoned decimal values with consistent results if the values are created in the same kind of operating environment that you use to run SAS.
The following table compares the zoned decimal format with notation in several programming languages:
Language | Zoned Decimal Notation |
---|---|
SAS | ZD3. |
PL/I | PICTURE 99T |
COBOL | DISPLAY PIC S 999 |
IBM 370 assembler | ZL3 |
y=put(x,zd4.);
put y $hex8.;
When x = ... | The Result [*] is ... |
---|---|
120 | F0F1F2C0 |
[*] 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. |