Dictionary


$ASCIIw. Format

Converts native format character data to ASCII representation

Category: Character

Alignment: left

Syntax

$ASCII w .

Syntax Description

w

  • specifies the width of the output field.

  • Default: 1

  • Range: 1 “32767

Details

If ASCII is the native format, no conversion occurs.

Comparisons
  • On EBCDIC systems, $ASCII w . converts EBCDIC character data to ASCII w .

  • On all other systems, $ASCII w . behaves like the $CHAR w . format.

Examples
 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.

$BIDIw. Format

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

$BINARYw. Format

Converts character data to binary representation

Category: Character

Alignment: left

Syntax

$BINARY w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: The default width is calculated based on the length of the variable to be printed.

  • Range: 1 “32767

Comparisons

The $BINARY w . format converts character values to binary representation. The BINARY w . format converts numeric values to binary representation.

Examples
 put @1 name $binary16.; 

When name = ...

The Result is ...

 

ASCII

EBCDIC

 

----+----1----+----2

----+----1----+----2

AB

0100000101000010

1100000111000010

$CHARw. Format

Writes standard character data

Category: Character

Alignment: left

Syntax

$CHAR w.

Syntax Description

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

Comparisons
  • 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)

Examples
 put @7 name $char4.; 

When name = ...

The Result is ...

   XYZ   
   ----+----1   XYZ   

$CPTDWw. Format

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

$CPTWDw. Format

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

$EBCDICw. Format

Converts native format character data to EBCDIC representation

Category: Character

Alignment: left

Syntax

$EBCDIC w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 1

  • Range: 1 “32767

Details

If EBCDIC is the native format, no conversion occurs.

Comparisons
  • On ASCII systems, $EBCDIC w . converts ASCII character data to EBCDIC.

  • On all other systems, $EBCDIC w . behaves like the $CHAR w . format.

Examples
 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.

$HEXw. Format

Converts character data to hexadecimal representation

Category: Character

Alignment: left

See: $HEX w . Format in the documentation for your operating environment.

Syntax

$HEX w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: The default width is calculated based on the length of the variable to be printed.

  • Range: 1 “32767

  • 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.

Details

The $HEX w . format converts each character into two hexadecimal digits. Each blank counts as one character, including trailing blanks.

Comparisons

The HEX w . format converts real binary numbers to their hexadecimal equivalent.

Examples
 put @5 name $hex4.; 

When name = ...

The Result is ...

 

EBCDIC

ASCII

   AB   
   ----+----1   C1C2   
   ----+----1   4142   

$KANJIw. Format

Adds shift-code data to DBCS data

Category: DBCS

Alignment: left

See: The $KANJI format in SAS National Language Support (NLS): User s Guide

$KANJIXw. Format

Removes shift code data from DBCS data

Category: DBCS

Alignment: left

See: The $KANJIX format in SAS National Language Support (NLS): User s Guide

$LOGVSw. Format

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

$LOGVSRw. Format

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

$MSGCASEw. Format

Writes character data in uppercase when the MSGCASE system option is in effect

Category: Character

Alignment: left

Syntax

$MSGCASE w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 8 if the length of the variable is undefined ; otherwise, the length of the variable

  • Range: 1 “32767

Details

When the MSGCASE= system option is in effect, all notes, warnings, and error messages that SAS generates appear in uppercase. Otherwise, all notes, warnings, and error messages appear in mixed case. You specify the MSGCASE= system option in the configuration file or during the SAS invocation.

Operating Environment Information: For more information about the MSGCASE= system option, see the SAS documentation for your operating environment.

Examples
 put name $msgcase.; 

When name = ...

The Result is ...

sas

SAS

$OCTALw. Format

Converts character data to octal representation

Category: Character

Alignment: left

Syntax

$OCTAL w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: The default width is calculated based on the length of the variable to be printed.

    Range: 1 “32767

    Tip: Because each character value generates three octal characters, increase the value of w by three times the length of the character value.

Comparisons

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.

Example

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 

$QUOTEw. Format

Writes data values that are enclosed in double quotation marks

Category: Character

Alignment: left

Syntax

$QUOTE w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 8 if the length of the variable is undefined ; otherwise, the length of the variable + 2

  • Range: 2 “32767

    Tip: Make w wide enough to include the left and right quotation marks.

Details

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.

Examples
 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""'"   

$REVERJw. Format

Writes character data in reverse order and preserves blanks

Category: Character

Alignment: right

Syntax

$REVERJ w .

Syntax Description

w

  • specifies the width of the output field.

  • Default: 1 if w is not specified

  • Range: 1 “32767

Comparisons

The $REVERJ w . format is similar to the $REVERS w . format except that $REVERS w . left aligns the result by trimming all leading blanks.

Examples
 put @1 name $reverj7.; 

When name [*] = ...

The Result is ...

   ABCD###   ###ABCD   
   ----+----1   DCBA   DCBA   

[*] The character # represents a blank space.

$REVERSw. Format

Writes character data in reverse order and left aligns

Category: Character

Alignment: left

Syntax

$REVERS w .

Syntax Description

w

  • specifies the width of the output field.

  • Default: 1 if w is not specified

  • Range: 1 “32767

Comparisons

The $REVERS w . format is similar to the $REVERJ w . format except that $REVERJ w . does not left align the result.

Examples
 put @1 name $revers7.; 

When name [*] = ...

The Result is ...

 

----+----1

ABCD###

DCBA

###ABCD

DCBA

[*] The character # represents a blank space.

$UCS2Bw. Format

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

$UCS2BEw. Format

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

$UCS2Lw. Format

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

$UCS2LEw. Format

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

$UCS2Xw. Format

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

$UCS2XEw. Format

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

$UCS4Bw. Format

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

$UCS4BEw. Format

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

$UCS4Lw. Format

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

$UCS4LEw. Format

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

$UCS4Xw. Format

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

$UCS4XEw. Format

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

$UESCw. Format

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

$UESCEw. Format

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

$UNCRw. Format

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

$UNCREw. Format

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

$UPARENw. Format

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

$UPARENEw. Format

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

$UPCASEw. Format

Converts character data to uppercase

Category: Character

Alignment: left

Syntax

$ UPCASE w .

Syntax Description

w

  • specifies the width of the output field.

  • Default: 8 if the length of the variable is undefined ; otherwise, the length of the variable

  • Range: 1 “32767

Details

Special characters, such as hyphens and other symbols, are not altered .

Examples
 put @1 name $upcase9.; 

When name = ...

The Result is ...

 

----+----1

coxe-ryan

COXE-RYAN

$UTF8Xw. Format

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

$VARYINGw. Format

Writes character data of varying length

Valid: in DATA step

Category: Character

Alignment: left

Syntax

$VARYING w. length-variable

Syntax Description

w

  • specifies the maximum width of the output field for any output line or output file record.

  • Default: 8 if the length of the variable is undefined ; otherwise, the 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 .

Details

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.

Examples
Example 1: Obtaining a Variable Length Directly

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.

Example 2: Obtaining a Variable Length Indirectly

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.

$VSLOGw. Format

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

$VSLOGRw. Format

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

$w. Format

Writes standard character data

Category: Character

Alignment: left

Alias: $F w .

Syntax

$ w.

Syntax Description

w

  • specifies the width of the output field. You can specify a number or a column range.

  • Default: 1 if the length of the variable is undefined ; otherwise, the length of the variable

  • Range: 1 “32767

Comparisons

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.

Examples
 put @10 name .;  put name $ 10-15; 

Values [*]

Results

   #Cary   Tokyo   
   ----+----1----+----2   Cary   Tokyo   

[*] The character # represents a blank space.

BESTw. Format

SAS chooses the best notation

Category: Numeric

Alignment: right

See: BEST w . Format in the documentation for your operating environment.

Syntax

BEST w.

Syntax Description

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

Details

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.

Examples

The following statements produce these results.

SAS Statements

Results

   x=1257000   put x best6.;   x=1257000   put x best3.;   
   ----+----1----+----2   1.26E6   1E6   

BINARYw. Format

Converts numeric values to binary representation

Category: Numeric

Alignment: left

Syntax

BINARY w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 8

  • Range: 1 “64

Comparisons

BINARY w . converts numeric values to binary representation. The $BINARY w . format converts character values to binary representation.

Examples
 put @1 x binary8.; 

When x = ...

The Result is ...

 

----+----1

123.45

01111011

123

01111011

-123

10000101

COMMAw.d Format

Writes numeric values with a comma that separates every three digits and a period that separates the decimal fraction

Category: Numeric

Alignment: right

Syntax

COMMA w . d

Syntax Description

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

Details

The COMMA w . d format writes numeric values with a comma that separates every three digits and a period that separates the decimal fraction.

Comparisons
  • 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.

Examples
 put @10 sales comma10.2; 

When sales = ...

The result is ...

   23451.23   123451.234   
   ----+----1----+----2   23,451.23   123,451.23   
See Also

Formats:

  • COMMAX w . d Format on page 116

  • DOLLAR w . d Format on page 127

COMMAXw.d Format

Writes numeric values with a period that separates every three digits and a comma that separates the decimal fraction

Category: Numeric

Alignment: right

Syntax

COMMAX w . d

Syntax Description

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

Details

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.

Comparisons

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.

Examples
 put @10 sales commax10.2; 

When sales = ...

The result is ...

   23451.23   123451.234   
   ----+----1----+----2   23.451,23   123.451,23   

Dw.s Format

Prints variables , possibly with a great range of values, lining up decimal places for values of similar magnitude

Category: Numeric

Alignment: right

Syntax

D w . s

Syntax Description

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

Details

The D w.s format writes numbers so that the decimal point aligns in groups of values with similar magnitude.

Comparisons
  • 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.

Examples
 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   

DATEw. Format

Writes date values in the form ddmmmyy or ddmmmyyyy

Category: Date and Time

Alignment: right

Syntax

DATE w.

Syntax Description

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.

Details

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.

Examples

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

See Also

Function:

  • DATE Function on page 481

Informat:

  • DATE w . Informat on page 977

DATEAMPMw.d Format

Writes datetime values in the form ddmmmyy:hh:mm:ss.ss with AM or PM

Category: Date and Time

Alignment: right

Syntax

DATEAMPM w.d

Syntax Description

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.

Details

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.

Comparisons

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.

Examples

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

See Also

Format:

  • DATETIME w . d Format on page 121

DATETIMEw.d Format

Writes datetime values in the form ddmmmyy:hh:mm:ss.ss

Category: Date and Time

Alignment: right

Syntax

DATETIME w.d

Syntax Description

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.

Details

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.

Examples

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  
See Also

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

DAYw. Format

Writes date values as the day of the month

Category: Date and Time

Alignment: right

Syntax

DAY w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 2

  • Range: 2 “32

Examples

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

DDMMYYw. Format

Writes date values in the form ddmm < yy > yy or dd / mm /< yy > yy , where a forward slash is the separator and the year appears as either 2 or 4 digits

Category: Date and Time

Alignment: right

Syntax

DDMMYY w.

Syntax Description

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 .

Details

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.

Examples

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

See Also

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

DDMMYYxw. Format

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

Syntax

DDMMYY xw.

Syntax Description

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.

Details

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.

Examples

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

See Also

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

DOLLARw.d Format

Writes numeric values with a leading dollar sign, a comma that separates every three digits, and a period that separates the decimal fraction

Category: Numeric

Alignment: right

Syntax

DOLLAR w . d

Syntax Description

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

Details

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.

Comparisons
  • 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.

Examples
 put @3 netpay dollar10.2; 

When netpay = ...

The result is ...

 

----+----1----+

1254.71

   ,254.71   
See Also

Formats:

  • COMMA w . d Format on page 115

  • DOLLARX w . d Format on page 128

DOLLARXw.d Format

Writes numeric values with a leading dollar sign, a period that separates every three digits, and a comma that separates the decimal fraction

Category: Numeric

Alignment: right

Syntax

DOLLARX w . d

Syntax Description

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

Details

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.

Comparisons
  • 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.

Examples
 put @3 netpay dollarx10.2; 

When netpay = ...

The result is ...

 

----+----1----+

1254.71

   .254,71   
See Also

Formats:

  • COMMAX w . d Format on page 116

  • DOLLAR w . d Format on page 127

DOWNAMEw. Format

Writes date values as the name of the day of the week

Category: Date and Time

Alignment: right

Syntax

DOWNAME w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 9

  • Range: 1 “32

  • Tip: If you omit w , SAS prints the entire name of the day.

Details

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.

Examples

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

See Also

Format:

  • WEEKDAY w . Format on page 220

DTDATEw. Format

Expects a datetime value as input and writes date values in the form ddmmmyy or ddmmmyyyy

Category: Date and Time

Alignment: right

Syntax

DTDATE w.

Syntax Description

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.

Details

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.

Comparisons

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.

Examples

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

See Also

Formats:

  • DATE w . Format on page 118

DTMONYYw. Format

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

Syntax

DTMONYY w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 5

  • Range: 5 “7

Details

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.

Comparisons

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.

Examples

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

See Also

Formats:

  • DATETIME w . d Format on page 121

  • MONYY w . Format on page 173

DTWKDATXw. Format

Writes the date part of a datetime value as the day of the week and the date in the form day-of-week , dd month-name yy (or yyyy )

Category: Date and Time

Alignment: right

Syntax

DTWKDATX w .

Syntax Description

w

  • specifies the width of the output field.

  • Default: 29

  • Range: 3 “37

Details

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.

Comparisons

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.

Examples

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   

See Also

Formats:

  • DATETIME w . d Format on page 121

  • WEEKDATX w . Format on page 218

DTYEARw. Format

Writes the date part of a datetime value as the year in the form yy or yyyy

Category: Date and Time

Alignment: right

Syntax

DTYEAR w .

Syntax Description

w

  • specifies the width of the output field.

  • Default: 4

  • Range: 2 “4

Comparisons

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.

Examples

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

See Also

Formats:

  • DATETIME w . d Format on page 121

  • YEAR w . Format on page 226

DTYYQCw. Format

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

Syntax

DTYYQC w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 4

  • Range: 4 “6

Details

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.

Examples

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

See Also

Formats:

  • DATETIME w . d Format on page 121

Ew. Format

Writes numeric values in scientific notation

Category: Numeric

Alignment: right

See: E w . Format in the documentation for your operating environment.

Syntax

E w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 12

  • Range: 7 “32

Details

SAS reserves the first column of the result for a minus sign.

Examples
 put @1 x e10.; 

When x = ...

The Result is ...

 

----+----1----+

1257

   1.257E+03   

-1257

-1.257E+03

EURDFDDw. Format

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

EURDFDEw. Format

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

EURDFDNw. Format

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

EURDFDTw.d Format

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

EURDFDWNw. Format

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

EURDFMNw. Format

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

EURDFMYw. Format

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

EURDFWDXw. Format

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

EURDFWKXw. Format

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

EURFRATSw.d Format

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

EURFRBEFw.d Format

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

EURFRCHFw.d Format

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

EURFRCZKw.d Format

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

EURFRDEMw.d Format

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

EURFRDKKw.d Format

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

EURFRESPw.d Format

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

EURFRFIMw.d Format

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

EURFRFRFw.d Format

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

EURFRGBPw.d Format

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

EURFRGRDw.d Format

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

EURFRHUFw.d Format

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

EURFRIEPw.d Format

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

EURFRITLw.d Format

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

EURFRLUFw.d Format

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

EURFRNLGw.d Format

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

EURFRNOKw.d Format

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

EURFRPLZw.d Format

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

EURFRPTEw.d Format

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

EURFRROLw.d Format

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

EURFRRURw.d Format

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

EURFRSEKw.d Format

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

EURFRSITw.d Format

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

EURFRTRLw.d Format

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

EURFRYUDw.d Format

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

EUROw.d Format

Writes numeric values with a leading euro symbol (E), a comma that separates every three digits, and a period that separates the decimal fraction

Category: Numeric

Alignment: right

See: The EURO format in SAS National Language Support (NLS): User s Guide

EUROXw.d Format

Writes numeric values with a leading euro symbol (E), a period that separates every three digits, and a comma that separates the decimal fraction

Category: Numeric

Alignment: right

See: The EUROX format in SAS National Language Support (NLS): User s Guide

EURTOATSw.d Format

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

EURTOBEFw.d Format

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

EURTOCHFw.d Format

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

EURTOCZKw.d Format

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

EURTODEMw.d Format

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

EURTODKKw.d Format

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

EURTOESPw.d Format

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

EURTOFIMw.d Format

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

EURTOFRFw.d Format

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

EURTOGBPw.d Format

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

EURTOGRDw.d Format

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

EURTOHUFw.d Format

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

EURTOIEPw.d Format

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

EURTOITLw.d Format

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

EURTOLUFw.d Format

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

EURTONLGw.d Format

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

EURTONOKw.d Format

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

EURTOPLZw.d Format

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

EURTOPTEw.d Format

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

EURTOROLw.d Format

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

EURTORURw.d Format

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

EURTOSEKw.d Format

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

EURTOSITw.d Format

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

EURTOTRLw.d Format

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

EURTOYUDw.d Format

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

FLOATw.d Format

Generates a native single-precision, floating-point value by multiplying a number by 10 raised to the d th power

Category: Numeric

Alignment: left

Syntax

FLOAT w.d

Syntax Description

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.

Details

This format is useful in operating environments where a float value is not the same as a truncated double. Values that are written by FLOAT4. 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.

Comparisons

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)

Examples
 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.

FRACTw. Format

Converts numeric values to fractions

Category: Numeric

Alignment: right

Syntax

FRACT w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 10

  • Range: 4 “32

Details

Dividing the number 1 by 3 produces the value 0.33333333. To write this value as 1/3, use the FRACT w . format. FRACT w . writes fractions in reduced form, that is, 1/2 instead of 50/100.

Examples
 put x fract8.; 

When x = ...

The Result is ...

 

----+----1

0.6666666667

   2/3   

0.2784

   174/625   

HDATEw. Format

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

HEBDATEw. Format

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

HEXw. Format

Converts real binary (floating-point) values to hexadecimal representation

Category: Numeric

Alignment: left

See: HEX w . Format in the documentation for your operating environment.

Syntax

HEX w.

Syntax Description

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.

Details

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.

Comparisons

The HEX w . numeric format and the $HEX w . character format both generate the hexadecimal equivalent of values.

Examples
 put @8 x hex8.; 

When x = ...

The Result is ...

   35.4   88   2.33     150   
   ----+----1----+----2   00000023   00000058   00000002   FFFFFF6A   

HHMMw.d Format

Writes time values as hours and minutes in the form hh:mm

Category: Date and Time

Alignment: right

Syntax

HHMM w.d

Syntax Description

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

Details

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.

Comparisons

The HHMM w . d format is similar to the TIME w . d format except that the HHMM w . d format does not print seconds.

Examples

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.

See Also

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

HOURw.d Format

Writes time values as hours and decimal fractions of hours

Category: Date and Time

Alignment: right

Syntax

HOUR w.d

Syntax Description

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

Details

SAS rounds hours based on the value of minutes in the SAS time value.

Examples

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

See Also

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

IBw.d Format

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.

Syntax

IB w . d

Syntax Description

w

  • specifies the width of the output field.

  • Default: 4

  • Range: 1 “8

d

  • optionally specifies to multiply the number by 10 d .

Details

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.

Comparisons

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.

Examples
 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.

See Also

Format:

  • IBR w . d Format on page 159

IBRw.d Format

Writes integer binary (fixed-point) values in Intel and DEC formats

Category: Numeric

Alignment: left

Syntax

IBR w . d

Syntax Description

w

  • specifies the width of the output field.

  • Default: 4

  • Range: 1 “8

d

  • optionally specifies to multiply the number by 10 d .

Details

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.

Comparisons
  • 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.

Examples
 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.

See Also

Format:

  • IB w . d Format on page 157

IEEEw.d Format

Generates an IEEE floating-point value by multiplying a number by 10 raised to the d th power

Category: Numeric

Alignment: left

Syntax

IEEE w.d

Syntax Description

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 .

Details

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.

Examples
 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.

JULDAYw. Format

Writes date values as the Julian day of the year

Category: Date and Time

Alignment: right

Syntax

JULDAY w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 3

  • Range: 3 “32

Details

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 ).

Examples

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   

JULIANw. Format

Writes date values as Julian dates in the form yyddd or yyyyddd

Category: Date and Time

Alignment: left

Syntax

JULIAN w.

Syntax Description

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.

Details

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.

Examples

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

See Also

Functions:

  • DATEJUL Function on page 481

  • JULDATE Function on page 614

Informat:

  • JULIAN w . Informat on page 990

MINGUOw. Format

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

MMDDYYw. Format

Writes date values in the form mmdd < yy > yy or mm / dd /< yy > yy , where a forward slash is the separator and the year appears as either 2 or 4 digits

Category: Date and Time

Alignment: right

Syntax

MMDDYY w.

Syntax Description

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.

Details

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.

Examples

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

See Also

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

MMDDYYxw. Format

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

Syntax

MMDDYY xw.

Syntax Description

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.

Details

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.

Examples

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

See Also

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

MMSSw.d Format

Writes time values as the number of minutes and seconds since midnight

Category: Date and Time

Alignment: right

Syntax

MMSS w.d

Syntax Description

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

Examples

The example table uses the input value of 4530.

When the SAS Statement is ...

The Result is ...

 

----+----1

put time mmss.;

75:30

See Also

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

MMYYw. Format

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

Syntax

MMYY w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 7

  • Range: 5 “32

  • Interaction: When w has a value of 5 or 6, the date appears with only the last two digits of the year. When w is 7 or more, the date appears with a four-digit year.

Details

The 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.

Examples

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  
See Also

Format:

  • MMYY xw . Format on page 169

  • YYMM w . Format on page 227

MMYYxw. Format

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

Syntax

MMYY xw.

Syntax Description

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.

Details

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.

Examples

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   
See Also

Format:

  • MMYY w . Format on page 168

  • YYMM xw . Format on page 228

MONNAMEw. Format

Writes date values as the name of the month

Category: Date and Time

Alignment: right

Syntax

MONNAME w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 9

  • Range: 1 “32

  • Tip: Use MONNAME3. to print the first three letters of the month name.

Details

If necessary, SAS truncates the name of the month to fit the format width.

Examples

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

See Also

Format:

  • MONTH w . Format on page 172

MONTHw. Format

Writes date values as the month of the year

Category: Date and Time

Alignment: right

Syntax

MONTH w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 2

  • Range: 1 “21

  • Tip: Use MONTH1. to obtain a hex value.

Details

The MONTH w . format writes the month (1 through 12) of the year from a SAS date value.

Examples

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

See Also

Format:

  • MONNAME w . Format on page 171

MONYYw. Format

Writes date values as the month and the year in the form mmmyy or mmmyyyy

Category: Date and Time

Alignment: right

Syntax

MONYY w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 5

  • Range: 5 “7

Details

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.

Comparisons

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.

Examples

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

See Also

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

NEGPARENw.d Format

Writes negative numeric values in parentheses

Category: Numeric

Alignment: right

Syntax

NEGPAREN w . d

Syntax Description

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.

Details

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.

Comparisons

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.

Examples
 put @1 sales negparen6.; 

When sales = ...

The result is ...

   100   1000     200     2000   
   ----+----1----+   100   1,000   (200)     2,000   

NENGOw. Format

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

NLDATEw. Format

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

NLDATEMNw. Format

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

NLDATEWw. Format

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

NLDATEWNw. Format

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

NLDATMw. Format

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

NLDATMAPw. Format

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

NLDATMTMw. Format

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

NLDATMWw. Format

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

NLMNYw.d Format

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

NLMNYIw.d Format

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

NLNUMw.d Format

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

NLNUMIw.d Format

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

NLPCTw.d Format

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

NLPCTIw.d Format

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

NLTIMAPw. Format

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

NLTIMEw. Format

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

NUMXw.d Format

Writes numeric values with a comma in place of the decimal point

Category: Numeric

Alignment: right

Syntax

NUMX w.d

Syntax Description

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.

Details

The NUMX w . d format writes numeric values with a comma in place of the decimal point.

Comparisons

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.

Examples
 put x numx10.2; 

When x = ...

The Result is ...

   896.48   64.89   3064.10   
   ----+----1----+   896,48   64,89   3064,10   

See Also

Format:

  • w . d Format on page 215

Informat:

  • NUMX w . d Informat on page 998

OCTALw. Format

Converts numeric values to octal representation

Category: Numeric

Alignment: left

Syntax

OCTAL w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 3

  • Range: 1 “24

Details

If necessary, the OCTAL w . format converts numeric values to integers before displaying them in octal representation.

Comparisons

OCTAL w . converts numeric values to octal representation. The $OCTAL w . format converts character values to octal representation.

Examples
 put x octal6.; 

When x = ...

The Result is ...

 

----+----1

3592

007010

PDw.d Format

Writes data in packed decimal format

Category: Numeric

Alignment: left

See: PD w . d Format in the documentation for your operating environment.

Syntax

PD w.d

Syntax Description

w

  • specifies the width of the output field. The w value specifies the number of bytes, not the number of digits. (In packed decimal data, each byte contains two digits.)

  • Default: 1

  • Range: 1 “16

d

  • optionally specifies to multiply the number by 10 d .

Details

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.

Comparisons

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

Examples
 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.

PDJULGw. Format

Writes packed Julian date values in the hexadecimal format yyyyddd F for IBM

Category: Date and Time

Syntax

PDJULG w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 4

  • Range: 3-16

Details

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.

Examples

When the SAS Statement is ...

The Result is ...

 

----+----1

date = 17mar2005 d;

juldate = put(date,pdjulg4.);

put juldate $hex8.;

   2005076F   
See Also

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

PDJULIw. Format

Writes packed Julian date values in the hexadecimal format ccyyddd F for IBM

Category: Date and Time

Syntax

PDJULI w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 4

  • Range: 3-16

Details

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.

Examples

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   
See Also

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

PERCENTw.d Format

Writes numeric values as percentages

Category: Numeric

Alignment: right

Syntax

PERCENT w.d

Syntax Description

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

Details

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.

Examples
 put @10 gain percent10.; 

When gain = ...

The Result is ...

   0.1   1.2     0.05   
   ----+----1----+----2   10%   120%   (5%)   

PIBw.d Format

Writes positive integer binary (fixed-point) values

Category: Numeric

Alignment: left

See: PIB w . d Format in the documentation for your operating environment.

Syntax

PIB w . d

Syntax Description

w

  • specifies the width of the output field.

  • Default: 1

  • Range: 1 “8

d

  • optionally specifies to multiply the number by 10 d .

Details

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.

Comparisons
  • 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.

Examples
 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.

See Also

Format:

  • PIBR w . d Format on page 187

PIBRw.d Format

Writes positive integer binary (fixed-point) values in Intel and DEC formats

Category: Numeric

Syntax

PIBR w . d

Syntax Description

w

  • specifies the width of the input field.

  • Default: 1

  • Range: 1 “8

d

  • optionally specifies to multiply the number by 10 d .

Details

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.

Comparisons
  • 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.

Examples
 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.

See Also

Informat:

  • PIB w . d Informat on page 1006

PKw.d Format

Writes data in unsigned packed decimal format

Category: Numeric

Alignment: left

Syntax

PK w.d

Syntax Description

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

Details

Each byte of unsigned packed decimal data contains two digits.

Comparisons

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.

Examples
 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.

PVALUEw.d Format

Writes p -values

Category: Numeric

Alignment: right

Syntax

PVALUE w.d

Syntax Description

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

Comparisons

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

Examples
 put x pvalue6.4; 

When x = ...

The Result is ...

 

----+----1

.05

0.0500

0.000001

< .0001

< .0001

.0123456

0.0123

QTRw. Format

Writes date values as the quarter of the year

Category: Date and Time

Alignment: right

Syntax

QTR w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 1

  • Range: 1 “32

Examples

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

See Also

Format:

  • QTRR w . Format on page 192

QTRRw. Format

Writes date values as the quarter of the year in Roman numerals

Category: Date and Time

Alignment: right

Syntax

QTRR w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 3

  • Range: 3 “32

Examples

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

See Also

Format:

  • QTR w . Format on page 191

RBw.d Format

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.

Syntax

RB w . d

Syntax Description

w

  • specifies the width of the output field.

  • Default: 4

  • Range: 2 “8

d

  • optionally specifies to multiply the number by 10 d .

Details

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.

Comparisons

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

Examples
 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.

ROMANw. Format

Writes numeric values as roman numerals

Category: Numeric

Alignment: left

Syntax

ROMAN w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 6

  • Range: 2 “32

Details

The ROMAN w . format truncates a floating-point value to its integer component before the value is written.

Examples
 put @5 year roman10.; 

When year = ...

The Result is ...

1998

MCMXCVIII

S370FFw.d Format

Writes native standard numeric data in IBM mainframe format

Category: Numeric

Syntax

S370FF w.d

Syntax Description

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

Details

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.

Comparisons

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.

Examples
 y=put(x,s370ff5.);  put y $hex10.; 

When x= ...

The Result [*] is ...

----+----1

 

12345

F1F2F3F4F5

[*] The result is the hexadecimal representation for the integer.

See Also

Formats:

  • $EBCDIC w . Format on page 96

  • w . d Format on page 215

S370FIBw.d Format

Writes integer binary (fixed-point) values, including negative values, in IBM mainframe format

Category: Numeric

Alignment: left

Syntax

S370FIB w . d

Syntax Description

w

  • specifies the width of the output field.

  • Default: 4

  • Range: 1 “8

d

  • optionally specifies to multiply the number by 10 d .

Details

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.

Comparisons
  • 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.

Examples
 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.

See Also

Formats:

  • S370FIBU w . d Format on page 197

  • S370FPIB w . d Format on page 201

S370FIBUw.d Format

Writes unsigned integer binary (fixed-point) values in IBM mainframe format

Category: Numeric

Alignment: left

Syntax

S370FIBU w . d

Syntax Description

w

  • specifies the width of the output field.

  • Default: 4

  • Range: 1 “8

d

  • optionally specifies to multiply the number by 10 d .

Details

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.

Comparisons
  • 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.

Examples
 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.

See Also

Formats:

  • S370FIB w . d Format on page 196

  • S370FPIB w . d Format on page 201

S370FPDw.d Format

Writes packed decimal data in IBM mainframe format

Category: Numeric

Alignment: left

Syntax

S370FPD w.d

Syntax Description

w

  • specifies the width of the output field.

  • Default: 1

  • Range: 1 “16

d

  • optionally specifies to multiply the number by 10 d .

Details

Use S370FPD w . d in other operating environments to write packed decimal data in the same format as on an IBM mainframe computer.

Comparisons

The following table shows the notation for equivalent packed decimal formats in several programming languages:

Language

Packed Decimal Notation

SAS

S370FPD4.

PL/I

FIXED DEC(7,0)

COBOL

COMP-3 PIC S9(7)

IBM 370 assembler

PL4

Examples
 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.

S370FPDUw.d Format

Writes unsigned packed decimal data in IBM mainframe format

Category: Numeric

Alignment: left

Syntax

S370FPDU w . d

Syntax Description

w

  • specifies the width of the output field.

  • Default: 1

  • Range: 1 “16

d

  • optionally specifies to multiply the number by 10 d .

Details

Use S370FPDU w . d in other operating environments to write unsigned packed decimal data in the same format as on an IBM mainframe computer.

Comparisons
  • 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.

Examples
 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.

S370FPIBw.d Format

Writes positive integer binary (fixed-point) values in IBM mainframe format

Category: Numeric

Alignment: left

Syntax

S370FPIB w . d

Syntax Description

w

  • specifies the width of the output field.

  • Default: 4

  • Range: 1 “8

d

  • optionally specifies to multiply the number by 10 d .

Details

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.

Comparisons
  • 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.

Examples
 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.

See Also

Formats:

  • S370FIB w . d Format on page 196

  • S370FIBU w . d Format on page 197

S370FRBw.d Format

Writes real binary (floating-point) data in IBM mainframe format

Category: Numeric

Alignment: left

Syntax

S370FRB w . d

Syntax Description

w

  • specifies the width of the output field.

  • Default: 6

  • Range: 2 “8

d

  • optionally specifies to multiply the number by 10 d .

Details

A floating-point value consists of two parts : a mantissa that gives the value and an exponent that gives the value s magnitude.

Use S370FRB w . d in other operating environments to write floating-point binary data in the same format as on an IBM mainframe computer.

Comparisons

The following table shows the notation for equivalent floating-point formats in several programming languages:

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

Examples
 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.

S370FZDw.d Format

Writes zoned decimal data in IBM mainframe format

Category: Numeric

Alignment: left

Syntax

S370FZD w . d

Syntax Description

w

  • specifies the width of the output field.

  • Default: 8

  • Range: 1 “32

d

  • optionally specifies to multiply the number by 10 d .

Details

Use S370FZD w . d in other operating environments to write zoned decimal data in the same format as on an IBM mainframe computer.

Comparisons

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

Examples
 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.

S370FZDLw.d Format

Writes zoned decimal leading “sign data in IBM mainframe format

Category: Numeric

Alignment: left

Syntax

S370FZDL w . d

Syntax Description

w

  • specifies the width of the output field.

  • Default: 8

  • Range: 1 “32

d

  • optionally specifies to multiply the number by 10 d .

Details

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.

Comparisons
  • 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.

Examples
 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.

S370FZDSw.d Format

Writes zoned decimal separate leading-sign data in IBM mainframe format

Category: Numeric

Alignment: left

Syntax

S370FZDS w . d

Syntax Description

w

  • specifies the width of the output field.

  • Default: 8

  • Range: 2 “32

d

  • optionally specifies to multiply the number by 10 d .

Details

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.

Comparisons
  • 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.

Examples
 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.

S370FZDTw.d Format

Writes zoned decimal separate trailing-sign data in IBM mainframe format

Category: Numeric

Alignment: left

Syntax

S370FZDT w . d

Syntax Description

w

  • specifies the width of the output field.

  • Default: 8

  • Range: 2 “32

d

  • optionally specifies to multiply the number by 10 d .

Details

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.

Comparisons
  • 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.

Examples
 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.

S370FZDUw.d Format

Writes unsigned zoned decimal data in IBM mainframe format

Category: Numeric

Alignment: left

Syntax

S370FZDU w . d

Syntax Description

w

  • specifies the width of the output field.

  • Default: 8

  • Range: 1 “32

d

  • optionally specifies to multiply the number by 10 d .

Details

Use S370FZDU w . d in other operating environments to write unsigned zoned decimal data in the same format as on an IBM mainframe computer.

Comparisons
  • 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.

Examples
 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.

SSNw. Format

Writes Social Security numbers

Category: Numeric

Alignment: none

Syntax

SSN w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 11

  • Restriction: w must be 11

Details

If the value is missing, SAS writes nine single periods with 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.

Examples
 put id ssn11.; 

When id = ...

The Result is ...

 

----+----1----+

263878439

263-87-8439

TIMEw.d Format

Writes time values as hours, minutes, and seconds in the form hh:mm:ss.ss

Category: Date and Time

Alignment: right

Syntax

TIME w.d

Syntax Description

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

Details

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.

Comparisons

The TIME w . d format is similar to the HHMM w . d format except that TIME w . d includes seconds.

Examples

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

See Also

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

TIMEAMPMw.d Format

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

Syntax

TIMEAMPM w.d

Syntax Description

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

Details

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.

Comparisons
  • 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.

Examples

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   
See Also

Format:

  • TIME w . d Format on page 210

TODw.d Format

Writes the time portion of datetime values in the form hh:mm:ss.ss

Category: Date and Time

Alignment: right

Syntax

TOD w.d

Syntax Description

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

Details

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.

Examples

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   
See Also

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

VAXRBw.d Format

Writes real binary (floating-point) data in VMS format

Category: Numeric

Alignment: right

Syntax

VAXRB w . d

Syntax Description

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.

Details

Use the VAXRB w . d format to write data in native VAX/VMS floating-point notation.

Comparisons

If you use SAS that is running under VAX/VMS, then the VAXRB w . d and the RB w . d formats are identical.

Example
 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.

w.d Format

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.

Syntax

w . d

Syntax Description

w

  • specifies the width of the output field.

  • Range: 1 “32

  • Tip: Allow enough space to write the value, the decimal point, and a minus sign, if necessary.

d

  • 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.

Details

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.

Comparisons

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.

Examples
 put @7 x 6.3; 

When x = ...

The Result is ...

 

----+----1----+

23.45

   23.450   

WEEKDATEw. Format

Writes date values as the day of the week and the date in the form day-of-week , month-name dd , yy (or yyyy )

Category: Date and Time

Alignment: right

Syntax

WEEKDATE w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 29

  • Range: 3 “37

Details

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.

Comparisons

The WEEKDATE w . format is the same as the WEEKDATX w . format except that WEEKDATX w . prints dd before the month s name.

Examples

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

See Also

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

WEEKDATXw. Format

Writes date values as the day of the week and date in the form day-of-week , dd month-name yy (or yyyy )

Category: Date and Time

Alignment: right

Syntax

WEEKDATX w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 29

  • Range: 3 “37

Details

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.

Comparisons

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.

Examples

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   
See Also

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

WEEKDAYw. Format

Writes date values as the day of the week

Category: Date and Time

Alignment: right

Syntax

WEEKDAY w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 1

  • Range: 1 “32

Details

The WEEKDAY w . format writes a SAS date value as the day of the week (where 1=Sunday, 2=Monday, and so on).

Examples

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

See Also

Format:

  • DOWNAME w . Format on page 130

WEEKUw. Format

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

WEEKVw. Format

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

WEEKWw. Format

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

WORDDATEw. Format

Writes date values as the name of the month, the day, and the year in the form month-name dd , yyyy

Category: Date and Time

Alignment: right

Syntax

WORDDATE w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 18

  • Range: 3 “32

Details

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.

Comparisons

The WORDDATE w . format is the same as the WORDDATX w . format except that WORDDATX w . prints dd before the month s name.

Examples

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   
See Also

Format:

  • WORDDATX w . Format on page 222

WORDDATXw. Format

Writes date values as the day, the name of the month, and the year in the form dd month-name yyyy

Category: Date and Time

Alignment: right

Syntax

WORDDATX w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 18

  • Range: 3 “32

Details

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.

Comparisons

The WORDDATX w . format is the same as the WORDDATE w . format except that WORDDATE w . prints dd after the month s name.

Examples

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   
See Also

Format:

  • WORDDATE w . Format on page 221

WORDFw. Format

Writes numeric values as words with fractions that are shown numerically

Category: Numeric

Alignment: left

Syntax

WORDF w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 10

  • Range: 5 “32767

Details

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.

Comparisons

The WORDF w . format is similar to the WORDS w . format except that WORDF w . prints fractions as numbers instead of words.

Examples
 put price wordf15.; 

When price = ...

The Result is ...

 

----+----1----+

2.5

two and 50/100

See Also

Format:

  • WORDS w . Format on page 225

WORDSw. Format

Writes numeric values as words

Category: Numeric

Alignment: left

Syntax

WORDS w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 10

  • Range: 5 “32767

Details

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.

Comparisons

The WORDS w . format is similar to the WORDF w . format except that WORDS w . prints fractions as words instead of numbers.

Examples
 put price words23.; 

When price = ...

The Result is ...

 

----+----1----+----2----+

2.1

two and ten hundredths

See Also

Format:

  • WORDF w . Format on page 224

YEARw. Format

Writes date values as the year

Category: Date and Time

Alignment: right

Syntax

YEAR w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 4

  • Range: 2 “32

  • Tip: If w is less than 4, the last two digits of the year print; otherwise, the year value prints as four digits.

Comparisons

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.

Examples

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

See Also

Format:

  • DTYEAR w . Format on page 134

YENw.d Format

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

YYMMw. Format

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

Syntax

YYMM w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 7

  • Range: 5 “32

  • Interaction: When w has a value of 5 or 6, the date appears with only the last two digits of the year. When w is 7 or more, the date appears with a four-digit year.

Details

The 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.

Examples

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  
See Also

Format:

  • MMYY w . Format on page 168

  • YYMM xw . Format on page 228

YYMMxw. Format

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

Syntax

YYMM xw.

Syntax Description

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.

Details

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.

Examples

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  
See Also

Format:

  • MMYY xw . Format on page 169

  • YYMM w . Format on page 227

YYMMDDw. Format

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

Syntax

YYMMDD w.

Syntax Description

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.

Details

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.

Examples

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

See Also

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

YYMMDDxw. Format

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

Syntax

YYMMDD xw.

Syntax Description

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.

Details

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.

Examples

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

See Also

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

YYMONw. Format

Writes date values in the form yymmm or yyyymmm

Category: Date and Time

Alignment: right

Syntax

YYMON w.

Syntax Description

w

  • specifies the width of the output field. If the format width is too small to print a four-digit year, only the last two digits of the year are printed.

  • Default: 7

  • Range: 5 “32

Details

The YYMON w . format abbreviates the month s name to three characters.

Examples

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

See Also

Format:

  • MMYY w . Format on page 168

YYQw. Format

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

Syntax

YYQ w.

Syntax Description

w

  • specifies the width of the output field.

  • Default: 6

  • Range: 4 “32

  • Interaction: When w has a value of 4 or 5, the date appears with only the last two digits of the year. When w is 6 or more, the date appears with a four-digit year.

Details

The 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.

Examples

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   
See Also

Formats:

  • YYQ xw . Format on page 235

  • YYQR w . Format on page 237

YYQxw. Format

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

Syntax

YYQ xw.

Syntax Description

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.

Details

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.

Examples

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   
See Also

Formats:

  • YYQ w . Format on page 234

  • YYQR xw . Format on page 238

YYQRw. Format

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

Syntax

YYQR w.

Syntax Description

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.

Details

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.

Examples

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  
See Also

Format:

  • YYQ w . Format on page 234

  • YYQR xw . Format on page 238

YYQRxw. Format

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

Syntax

YYQR xw.

Syntax Description

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.

Details

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.

Examples

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  
See Also

Format:

  • YYQ xw . Format on page 235

  • YYQR w . Format on page 237

Zw.d Format

Writes standard numeric data with leading 0s

Category: Numeric

Alignment: right

Syntax

Z w.d

Syntax Description

w

  • specifies the width of the output field.

  • Default: 1

  • Range: 1 “32

  • Tip: Allow enough space to write the value, the decimal point, and a minus sign, if necessary.

d

  • 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.

Details

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.

Comparisons

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.

Examples

put @5 seqnum z8.;

When seqnum = ...

The Result is ...

 

----+----1

1350

00001350

ZDw.d Format

Writes numeric data in zoned decimal format

Category: Numeric

Alignment: left

See: ZD w . d Format in the documentation for your operating environment.

Syntax

ZD w . d

Syntax Description

w

  • specifies the width of the output field.

  • Default: 1

  • Range: 1 “32

d

  • optionally specifies to multiply the number by 10 d .

Details

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.

Comparisons

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

Examples

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.




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net