Open In App

SAS : How to Display Current Date?

The today() function of SAS programming is basically used to generate current date. The format() function is used to display the format of the date in the specified format.

  1. In DD-MMM-YYYY format:

    Example:




    data _null_;
        dt=today();
        format dt yymmdd10.;
        put dt ;
    run;
    
    

    Output:

  2. In DDMMMYYYY format:

    Example:




    data _null_;
        dt=today();
        format dt date9.;
        put dt ;
    run;
    
    

    Output:



    20JUL2019
  3. In MONTH DD, YYYY format:

    Example:




    data _null_;
        dt=today();
        format dt WORDDATE.;
        put dt ;
    run;
    
    

    Output:

    JULY 20, 2019
  4. In WEEKDAY, MONTH DD, YYYY format:

    Example:




    data _null_;
        dt=today();
        format dt date9.;
        put dt ;
    run;
    
    

    Output:



    Saturday, July 20, 2019

Article Tags :