Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi there,

I am trying to write the date from SAS into SQL, but I want to write the date from the time it started till the time it ended, then say how long it took to create a dataset (duration).

SQL
%let time=%sysfunc(TIME(),TOD.);
%put &time;

%let todayStart=%sysfunc(today(), YYMMDD10.) &time;
%put &todayStart;

proc sql;
update con.tablename
set SASStarted = "&todayStart."
where ID = 123;
Quit;

%let time2=%sysfunc(TIME(),TOD.);
%put &tim2e;

%let todayStart2=%sysfunc(today(), YYMMDD10.) &time2;
%put &todayStart2;

proc sql;
update con.tablename
set SASStarted = "&todayStart2."
where Object_ID = 456;
Quit;



But whenever I run the code the date and time changes to the time it started at &todayStart; and not the actual time the dataset started each time it runs.

Not sure if I am making sense.
Posted
Updated 9-May-15 9:12am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900