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:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

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

    chevron_right

    
    

    Output:

  2. In DDMMMYYYY format:

    Example:



    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

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

    chevron_right

    
    

    Output:

    20JUL2019
  3. In MONTH DD, YYYY format:

    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

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

    chevron_right

    
    

    Output:

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

    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

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

    chevron_right

    
    

    Output:

    Saturday, July 20, 2019


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.