How to display dates with five-digit years


SAS® software can perform calculations on dates up to A.D. 19,900. However, most date formats are not capable of displaying year values with more than four digits. To display a date with a five-digit year, use either the WORDDATEw. format, or create a user-defined format using PROC FORMAT and the PICTURE statement. For example:

proc format;
   picture test other='%0m/%0d/%0Y' (datatype=date);
run;
data _null_;
   x='12jul18511'd;
   put x= test.;
run;

The following output is produced:

x=07/12/18511

Note that this code does not produce a five-digit year when it is run in a double-byte character set (DBCS) version of SAS or when your SAS session encoding is set to UTF-8.