Date: Mon, 27 Oct 2008 10:58:34 -0500
Reply-To: Mary <mlhoward@avalon.net>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mary <mlhoward@AVALON.NET>
Subject: Re: Add Timestamp to dataset's name
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
reply-type=original
This is a little longer, but gives you more control over the format; note
that you can't have a slash in a dataset name as in your example,
but you certainly could manipulate the date2_char variable I've got below to
put some more underscores in it or use other date
and time formats.
data dummy1;
informat date2_char $50.;
date2_char=compress('b_' || put(date(),yymmdd7.) || '_' ||
compress(put(time(),tod9.2),':'),' ');
call symput('datasetname',date2_char);
run;
%put &datasetname;
data &datasetname;
stop;
run;
-Mary
----- Original Message -----
From: sas 9 bi user
To: SAS-L@LISTSERV.UGA.EDU
Sent: Monday, October 27, 2008 12:15 AM
Subject: Add Timestamp to dataset's name
All -
Say I have
data b;
set a;
run;
I want to add a timestamp to B. When I try to do the below it errors out.
data b_&systfunc( datetime() );
set a;
run;
This is what I would like B to be named as:
b_10/27/2008_12:14AM
Note - Date/time is what sysfunc generates at time of call (so the above is
at the time of this email writing for example).
Any ideas?
Thanks!