How to get sas date format "YYYYMM"

36,396

Solution 1

Macro version:

%let date = %sysfunc(today());
%let me = %str(%")%sysfunc(intnx(month,&date,-1),yymmd7.)%str(%");

%put &me;

Solution 2

You can replace yymmdd10. with yymmd7. that should be the format you want.

Share:
36,396
JPC
Author by

JPC

Updated on September 16, 2020

Comments

  • JPC
    JPC over 3 years

    How to get sas date format "YYYYMM" in SAS ?

    From this code below I would get '2011-11-01'

    call symput('me',"'"||put(intnx('month',today(),-1 ),yymmdd10.)||"'");
    

    I'm trying to get something like : '2011-11'

    Thanks