I define a global variable as follows:
and SAS assign a number to the 'todaydate'. Anyone knows whether it is possible for me to format the 'todaydate', e.g. ddmmyy or ddmonyy etc?
If you DO want to use the today() function instead of &SYSDATE9, you can use it directly in the %LET, and with the TODAY() function, a second argument is allowed for %SYSFUNC that formats the returned date:
%let d1 = %sysfunc(today(),ddmmyy.);
%let d2 = %sysfunc(today(),worddate.);
%let d3 = %sysfunc(today(),mmddyy10.);
%let d4 = %sysfunc(putn("&sysdate9"d ,mmddyyp10.));
%let d5 = %sysfunc(putn('01Jan2008'd ,weekdate.));
&SYSDATE may not be the same date as TODAY(). Especially if your version of SAS is on a server that is not taken down often. Usually &SYSDATE is the date that the SAS session started...while TODAY() returns a value from the computer's "calendar/clock" functions.
Are you saying that today() does not return today's date????
%let x = %sysfunc(today());
%let y = %sysfunc(today(),mmddyy10.);
If these statements do not produce the following results, then you should contact Tech Support for more help. (If you're on the other side of the international date line, of course, your date will be off from mine by a day.
1 %let x = %sysfunc(today());
2 %let y = %sysfunc(today(),mmddyy10.);
4 %put *******x=&x y=&y;
Today's date in as a SAS number is 17764. With the mmddyy10. format applied, the macro variable &Y has a value of 08/20/2008.