Skip to main content
v2026.11,858 entries · CC-BY 4.0
LAC HealthMedical & Research SuppliesReagents, PPE & instruments — chain-of-custody documented.Fast, traceable sourcing built for regulated research environments, from bench consumables to instrumentation.Shop lac.us CodeCASRAIlac.us

Date Format in SAS: DATE9., MMDDYY10. and How to Change Them

How SAS date formats work: DATE and MMDDYY output by width, FORMAT vs informat, reading text dates, and what to do when a date prints as 19068.

Written and maintained by CASRAI Editorial Board

Last updated

A SAS date format changes how a date is displayed, not what is stored. SAS keeps a date as a number, the count of days from January 1, 1960 (dates before that are negative), and a format such as DATE9. or MMDDYY10. turns that number into text like 16MAR2012 or 03/16/2012 when it is printed. This guide covers the formats people reach for most, how the width changes the output, and how to read text dates in with an informat.

What SAS date formats do in research data

Research datasets often carry dates such as enrolment, visits and follow-up. In SAS these are numeric variables, so the same value can be shown as 16MAR2012, 16-MAR-2012 or 03/16/2012 without changing it. The format only controls what you see; the stored number is unchanged. That is why a column that prints as 19068 is not broken: it is a valid date with no format attached.

Format versus informat

A format writes a stored value as text for display. An informat reads text and converts it into the stored value. The same date can therefore pass through both: the documentation reads 16mar12, 16 mar 12 or 16-mar-2012 with the DATE11. informat and gets the value 19068 each time, which is March 16, 2012. Changing the format afterwards never changes 19068.

Install or access (official source only)

Date formats and informats are documented in the SAS 9.4 Formats and Informats: Reference on support.sas.com. Run the code below in the SAS programming environment your institution provides.

Step-by-step: show a date the way you want

How do I format a date in SAS?

Attach a format to the date variable. The documentation describes two ways. A format named in a PUT statement applies only while that DATA step runs. A format named in a FORMAT statement (or ATTRIB) in a DATA step is permanently associated with the variable, because SAS records it in the descriptor information of the data set.

  1. Confirm the variable is numeric and holds a SAS date value (for example 19068), not a character string.
  2. In a DATA step, add a FORMAT statement naming the variable and the format, ending in a period: format calendar_date mmddyy10.;
  3. Run the step. Later steps that use the data set display the variable with that format.
  4. To change the display later, repeat the FORMAT statement with a different format. The stored number stays the same.

How do I read a text date into SAS?

Use an informat in an INPUT statement, then attach a display format. The documentation example reads dates with input calendar_date date11.;.

data visits;
  input calendar_date date11.;
  format calendar_date mmddyy10.;
  datalines;
16mar12
16-mar-2012
;
run;

Both lines are documented inputs that the DATE11. informat converts to 19068, so both rows hold the same date. The MMDDYY10. format then displays that value in the mm/dd/yyyy form.

How do I read dates written year first?

The YYMMDD informat reads yymmdd or yyyymmdd, and delimiters are allowed if they appear between all the values. With input calendar_date yymmdd10.; the documentation shows 120316, 12/03/16, 12 03 16 and 2012-03-16 all read as 19068. Its default width is 6 and it accepts widths 6 to 32.

Output and how to read it: width changes the result

The width after the format name decides how much of the date appears, and some widths silently drop the century or the separators. The tables below use the documentation’s own examples.

DATE format widths (value 19068, March 16, 2012)

Format Output Note
DATE5. 16MAR Day and month only
DATE6. (one space) 16MAR Leading space
DATE7. 16MAR12 Default width; two-digit year
DATE8. (one space) 16MAR12 Leading space
DATE9. 16MAR2012 Four-digit year, no separator
DATE11. 16-MAR-2012 Four-digit year with hyphens

The DATE format accepts widths 5 to 11 and writes the form ddmmmyy, ddmmmyyyy or dd-mmm-yyyy depending on the width.

MMDDYY format widths (value 19291, October 25, 2012)

Format Output
MMDDYY2. 10
MMDDYY4. 1025
MMDDYY5. 10/25
MMDDYY6. 102512
MMDDYY7. (one space) 102512
MMDDYY8. 10/25/12
MMDDYY10. 10/25/2012

The default width is 8 and the range is 2 to 10. As the documentation notes, when the width is 7 the date appears as a two-digit year without slashes, which is why MMDDYY7. looks like MMDDYY6. with a leading space. For a four-digit year with slashes, use width 10.

Troubleshooting

The date prints as a number such as 19068

The variable holds a valid SAS date value but has no date format. Add a FORMAT statement such as format calendar_date date9.;. If the variable is character instead, a format will not convert it; read the text with an informat.

The year is wrong when reading two-digit years

SAS interprets a two-digit year as belonging to the 100-year span defined by the YEARCUTOFF= system option. To avoid relying on that span, supply four-digit years and read them with a wide enough informat (the documentation tips width 9 for a four-digit year) so no guess is needed.

The year shows two digits

Widen the format. DATE7. is the default and gives 16MAR12; DATE9. gives 16MAR2012. For MMDDYY, use width 10.

Free alternatives (table)

If you do not have SAS, other free tools format dates with an explicit format string. These rows come from each tool’s own documentation.

Tool How a date is formatted Source
R (base) the format method for dates has the default format = "%Y-%m-%d"; %d is day of month, %m month number, %b abbreviated month name, %Y year with century. For numeric input, as.Date counts days from the origin you give, or from 1970-01-01 when none is supplied (R 4.3.0 and later). R documentation: as.Date, strptime
Python date.strftime(format) returns a string representing the date, controlled by an explicit format string. Python documentation: datetime

Note that R’s origin date differs from SAS’s: SAS counts days from January 1, 1960. For a comparison of statistical packages, see SAS vs SPSS for research analysis.

Related SAS guides

FAQ

What is the difference between date format and date formats in SAS?

There is no difference in meaning. People search “date format sas”, “date formats in sas” and “format sas date” for the same thing: a named format such as DATE9. or MMDDYY10. that controls how a stored date value is displayed.

How do I format a date in SAS as dd-mmm-yyyy?

Use DATE11.. For the value 19068 it writes 16-MAR-2012. Use DATE9. for 16MAR2012 with no hyphens.

How do I format a date in SAS as mm/dd/yyyy?

Use MMDDYY10.. For the value 19291 it writes 10/25/2012.

Does changing the format change the data?

No. The stored value is the number of days from January 1, 1960, and the format only changes the displayed text.

Sources (official docs)

Checked 2026-10-29.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Date Format in SAS: DATE9., MMDDYY10. and How to Change Them

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →