Formats

List of Formats

  • $ — Writes standard character data
  • $BINARY — Converts character values to binary representation
  • $CHAR — Writes standard character data
  • $HEX — Converts character values to hexadecimal representation
  • $OCTAL — Converts character values to octal representation
  • $QUOTE — Converts character values to quoted strings
  • $VARYING — Writes varying length values
  • BEST — SAS Scalable Performance Data (SPD) Server system chooses best notation
  • BINARY — Converts numeric values to binary representation
  • COMMA — Writes numeric values with commas and decimal points
  • COMMAX — Writes numeric values with commas and decimal points (European style)
  • DATE — Writes date values (ddmmmyy)
  • DATETIME — Writes date time values (ddmmmyy:hh:mm:ss.ss)
  • DAY — Writes day of month
  • DDMMYY — Writes date values (ddmmyy)
  • DOLLAR — Writes numeric values with dollar signs, commas, and decimal points
  • DOLLARX — Writes numeric values with dollar signs, commas, and decimal points (European style)
  • DOWNAME — Writes name of day of the week
  • E — Writes scientific notation
  • F — Writes scientific notation
  • FRACT — Converts values to fractions
  • HEX -- Converts real binary (floating-point) numbers to hexadecimal representation
  • HHMM — Writes hours and minutes
  • HOUR — Writes hours and decimal fractions of hours
  • IB — Writes integer binary values
  • MMDDYY — Writes date values (mmddyy)
  • MMSS — Writes minutes and seconds
  • MMYY — Writes month and year, separated by a 'M'
  • MONNAME — Writes name of month
  • MONTH — Writes month of year
  • MONYY — Writes month and year
  • NEGPAREN — Displays negative values in parentheses
  • OCTAL — Converts numeric values to octal representation
  • PD — Writes packed decimal data
  • PERCENT — Prints numbers as percentages
  • PIB — Writes positive integer binary values
  • QTR — Writes quarter of year
  • RB — Writes real binary (floating-point) data
  • SSN — Writes Social Security numbers
  • TIME — Writes hours, minutes, and seconds
  • TOD — Writes the time portion of datetime values
  • w.d — Writes standard numeric data
  • WEEKDATE — Writes day of week and date (day-of-week, month-name dd, yy)
  • WEEKDATX — Writes day of week and date (day-of-week, dd month-name yy)
  • WEEKDAY — Writes day of week
  • WORDDATE — Writes date with name of month, day, and year (month-name dd, yyyy)
  • WORDDATX — Writes date with day, name of month, and year (dd month-name yyyy)
  • WORDF — Converts numeric values to words
  • WORDS — Converts numeric values to words (fractions as words)
  • YEAR — Writes year part of date value
  • YYMM — Write year and month, separated by a 'M'
  • YYMMDD — Writes day values (yymmdd)
  • YYMON — Writes year and month abbreviation
  • YYQ — Writes year and quarter, separated by a 'Q'
  • Z — Writes leading 0s
  • ZD — Writes data in zoned decimal format
Note: Formats which begin with a '$' sign are character formats. Otherwise, the format accepts numeric values.

Formats Example

Use the dollar. format to convert numeric sales figures into dollar values. Suppose you have an SPD Server data set Sales with a single numeric variable salesite representing the total sales for a given site. Using SQL pass-through, create a new data set containing the sales in dollar format.
PROC SQL;
connect to sasspds
  (dbq='tmp'
   user='anonymous'
   host='localhost'
   serv='5127');

execute(create table money
   as select salesite
   format=dollar.
   from sales)

by sasspds;

quit;