sas date - convert today() into yyyymmdd format

Allan Bowe picture Allan Bowe · Jul 30, 2009 · Viewed 93.2k times · Source

How do I convert a SAS date such as "30JUL2009"d into YYYYMMDD format (eg 20090730)?

So for instance:

data _null_;
  format test ?????;
  test=today();
  put test=;
run;

Would give me "test=20090730" in the log...

Answer

adam picture adam · Jul 30, 2009
data _null_;
    format test yymmddn8.;
    test=today();
    put test=;
run;

YYMMDDxw. documentation