Chapter Contents

Previous

Next
SASDATEFMT=

SASDATEFMT=



Changes the SAS date format of a DBMS column.

Default value: DBMS specific


Syntax
Details

Syntax

SASDATEFMT=(<DBMS-date-col-1='SAS-date-format'><... <DBMS-date-col-n='SAS-date-format'>>)

DBMS-date-col
the name of a column in a DBMS table that contains dates.

SAS-date-format
a SAS date format that has an equivalent (like-named) informat. For example, DATETIME21.2 is both a SAS format and an informat, so it can be used as an argument of SASDATEFMT=.


Details

SASDATEFMT= changes the default SAS date format that is assigned to DBMS date values to a new SAS date format that you specify. The default SAS format is based on the data type of the DBMS column.

This option is used to convert DBMS date values to the correct SAS DATE, TIME, and DATETIME values during input operations, to convert SAS date values to the correct DBMS date values during output operations, and to prevent date type mismatches.

For non-English date types, SAS automatically converts the data to the SAS type of NUMBER. The SASDATEFMT= option does not currently handle these date types, but you can use a PROC SQL view to convert the DBMS data to a SAS date format as you retrieve the data, or use a format statement in other contexts.

In the following example, the APPEND procedure adds SAS data from the SASLIB.DELAY data set to the ORACLE table that is accessed by MYDBLIB.INTERNAT. Using SASDATEFMT=, the default SAS format for the ORACLE column DATES is changed to the DATE9. format. Data output from SASLIB.DELAY into the DATES column in MYDBLIB.INTERNAT now converts from the DATE9. format to the ORACLE format assigned to that type.

 libname mydblib oracle user=karin password=haggis;
 libname saslib 'your-SAS-library';
 proc append base=mydblib.internat(sasdatefmt=(dates='date9.'))force
    data=saslib.delay;
run; 

SASDATEFMT= can also be specified with the following alias: SASDATEINFMT=.

See your DBMS chapter to determine if your SAS/ACCESS interface supports SASDATEFMT= and, if so, for the default formats that SAS assigns to each DBMS data type.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.