From: oloolo on
when did u launched ur SAS session?

On Mon, 4 Jan 2010 14:26:37 -0800, df ss <tggsun(a)YAHOO.COM> wrote:

>Hello SASor,
>I run the following code today.
>data a;
>format a$7.;
>a= "&sysdate" ;
>run;
>proc print;run;
>
>the date value in variable a is: 31DEC09. I hope the value of a is 04JAN10.
>what's wrong about the &sysdate?
>Thank you,
>dd sf
From: Patrick on
What oloolo tries to tell you here: &sysdate contains the start date
of the SAS session (i.e. the date you connected via SAS EG to the
server).

If you want the date of when the code was executed you have to use the
SAS function date(), i.e:

%let rundate=%sysfunc(date(),date9.);
data a;
format a$7.;
a= "&rundate" ;
run;
proc print;run;

or even better:
%let rundate=%sysfunc(date());
data a;
format a date9.;
retain a &rundate. ;
run;
proc print;run;
From: "Kirby, Ted" on
As you may figure out from Oloolo's question, the SYSDATE macro variable
returns the date that the current SAS session was launched, which may
not necessarily be today.

-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of
oloolo
Sent: Monday, January 04, 2010 5:31 PM
To: SAS-L(a)LISTSERV.UGA.EDU
Subject: Re: &sysdate question

when did u launched ur SAS session?

On Mon, 4 Jan 2010 14:26:37 -0800, df ss <tggsun(a)YAHOO.COM> wrote:

>Hello SASor,
>I run the following code today.
>data a;
>format a$7.;
>a= "&sysdate" ;
>run;
>proc print;run;
>
>the date value in variable a is: 31DEC09. I hope the value of a is
04JAN10.
>what's wrong about the &sysdate?
>Thank you,
>dd sf
************* IMPORTANT - PLEASE READ ********************

This e-mail, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed. If the reader of this e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately.

From: Susan Cloninger on
There is a system option that can make a difference in these types of
situations, i.e., where it is important to have "date/time as of this
moment."

Hope this helps!
Susan


-------------------------------------------------------------------------
-------------------------------------------------------------------------

SAS System Options

DTRESET System Option

Syntax DTRESET | NODTRESET

-------------------------------------------------------------------------
Specifies whether to update the date and time in the SAS log and in the
procedure output file.

DTRESET specifies that SAS update the date and time in the titles of the
SAS log and the procedure output file.

NODTRESET specifies that SAS not update the date and time in the titles
of the SAS log and the procedure output file.

-------------------------------------------------------------------------

Details

The DTRESET system option updates the date and time in the titles of the
SAS log and the procedure output file. This update occurs when the page
is being written. The smallest time increment that is reflected is
minutes.

The DTRESET option is especially helpful in obtaining a more accurate
date and time stamp when you run long SAS jobs.

When you use NODTRESET, SAS displays the date and time that the job
originally started.
From: Susan Cloninger on
Sorry -- should have done a little more checking first, but DTRESET does
not reset &sysdate, just the dates in titles apparently.

Susan


On Tue, 5 Jan 2010 09:05:12 -0500, Susan Cloninger <scloninger @ UMUC.EDU>
wrote:

>There is a system option that can make a difference in these types of
>situations, i.e., where it is important to have "date/time as of this
>moment."
>
>Hope this helps!
>Susan
>
>
>-------------------------------------------------------------------------
>-------------------------------------------------------------------------
>
>SAS System Options
>
>DTRESET System Option
>
>Syntax DTRESET | NODTRESET
>
>-------------------------------------------------------------------------
>Specifies whether to update the date and time in the SAS log and in the
>procedure output file.
>
>DTRESET specifies that SAS update the date and time in the titles of the
>SAS log and the procedure output file.
>
>NODTRESET specifies that SAS not update the date and time in the titles
>of the SAS log and the procedure output file.
>
>-------------------------------------------------------------------------
>
>Details
>
>The DTRESET system option updates the date and time in the titles of the
>SAS log and the procedure output file. This update occurs when the page
>is being written. The smallest time increment that is reflected is
>minutes.
>
>The DTRESET option is especially helpful in obtaining a more accurate
>date and time stamp when you run long SAS jobs.
>
>When you use NODTRESET, SAS displays the date and time that the job
>originally started.