SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Reading Date and Time Values
Reading Dates and Times Using Informats


You use SAS date and time informats to read date and time expressions and convert them to SAS date and time values. Like other SAS informats, date and time informats are composed of
  • an informat name
  • a field width
  • a period delimiter.

SAS informat names indicate the form of date expression that can be read using that particular informat. Here are some examples of common date and time informats:

  • DATEw.
  • DATETIMEw.
  • MMDDYYw.
  • TIMEw.

As you know, there are several ways to write a particular date. For example, all the following expressions represent the date October 15, 1999. Each of these common date expressions can be read using the appropriate SAS date informat.


Date Expression SAS Date Informat
10/15/99 MMDDYYw.
15Oct99 DATEw.
10-15-99 MMDDYYw.
99/10/15 YYMMDDw.


General form, INPUT statement with an informat:
INPUT <pointer-control> variable informat.;

where

  • pointer-control gives the absolute or relative position of the pointer.
  • variable is the name of the variable being read.
  • informat. is any valid SAS informat. Note that the format includes a final decimal point.



back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement