Help using Base SAS procedures

SAS Date Question

Reply
Regular Contributor
Posts: 173

SAS Date Question

Hello Everyone,

I am trying to put today's date in an output field in the format of mm/dd/yyyy or mm/dd/yy.

If I use today() i get a sas date. But i am not sure how to convert it to the formats above.

Thank you so much for any input!
Super Contributor
Super Contributor
Posts: 3,174

Re: SAS Date Question

It depends on the technique you are using to display the "formatted" date. If you assign a SAS DATE (numeric) variable using today(), then you would use a FORMAT statement in your program with the desired output format specified for your variable, as shown below:

mydate = today();
format mydate mmddyys10.;


And, if you are using a SAS macro variable, you must run the SAS-generate text with a function, as shown below:

TITLE2 "RUN DATE: %SYSFUNC(TODAY(),MMDDYYS10.)";

Scott Barry
SBBWorks, Inc.
Regular Contributor
Posts: 173

Re: SAS Date Question

Thank you so much, Scott! That worked beautifully Smiley Happy
Ask a Question
Discussion stats
  • 2 replies
  • 110 views
  • 0 likes
  • 2 in conversation