• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Programming Expert

Solving All of Your Programming Headaches

  • HTML
  • JavaScript
  • jQuery
  • PHP
  • Python
  • SAS
  • Ruby
  • About
You are here: Home / SAS / Date Format ddmmmyyyy in SAS

Date Format ddmmmyyyy in SAS

September 15, 2022 Leave a Comment

To format a date in SAS like ddmmmyyyy, you can use the date9. date format.

data example;
    d = "15sep2022"d;
    put d date9.;
run;

// Log Output:
15SEP2022

When working with different variables in SAS, the ability to change formats easily is valuable.

One such case is if you have a date and want to format it differently.

A common date format which is commonly used in real world applications is showing a date like ddmmmyyyy.

To format a date like ddmmmyyyy in SAS, you can use the datew. date format. To get a date like ddmmmyyyy, you can use date9.

Below shows you how to format a date with the date9. date format in SAS.

data example;
    d = "15sep2022"d;
    put d date9.;
run;

// Log Output:
15SEP2022

Formatting a Date in SAS like ddmmmyyyy with datew.

You can use the datew. format to format dates like ddmmmyyyy with two other widths.

Two other date formats which might make sense are date8. and date11.

Below shows you how to format a date with the date8. and date11. in a SAS data step.

data example;
    d = "15sep2022"d;
    put d date8.;
    put d date9.;
    put d date11.;
run;

// Log Output:
  15SEP22
15SEP2022
15-SEP-2022

Hopefully this article has been useful for you to learn how to format a date in SAS like ddmmmyyyy.

Other Articles You'll Also Like:

  • 1.  SAS %eval() Function – Evaluate Expressions in SAS Macro
  • 2.  SAS intnx – Add or Subtract Time from Date Variables in SAS Data Step
  • 3.  Concatenating Strings in a SAS Data Step
  • 4.  mod Function in SAS – Find Remainder of 2 Numbers After Division
  • 5.  SAS If Then Statements with Multiple Variables
  • 6.  SAS year function – Get Year from Date Variable
  • 7.  SAS floor – Round Down to Floor of Number in a SAS Data Step
  • 8.  SAS Percent Format – Formatting Number as Percent in SAS Dataset
  • 9.  SAS round – Rounding Numbers in a SAS Data Step
  • 10.  SAS ceil – Round Up to Ceiling of Number in a SAS Data Step

About The Programming Expert

The Programming Expert is a compilation of a programmer’s findings in the world of software development, website creation, and automation of processes.

Programming allows us to create amazing applications which make our work more efficient, repeatable and accurate.

At the end of the day, we want to be able to just push a button and let the code do it’s magic.

You can read more about us on our about page.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

About The Programming Expert

the programming expert main image

Welcome to The Programming Expert. We are a group of US-based programming professionals who have helped companies build, maintain, and improve everything from simple websites to large-scale projects.

We built The Programming Expert to help you solve your programming problems with useful coding methods and functions in various programming languages.

Search

Learn Coding from Experts on Udemy

Looking to boost your skills and learn how to become a programming expert?

Check out the links below to view Udemy courses for learning to program in the following languages:

Copyright © 2023 · The Programming Expert · About · Privacy Policy