Below is the input dataset date.
I wanted output with adding up 40 minutes to the variable 'date' until it is equal or greater than 'final' variable. (wanted to create new 'result' variable for this)
but facing error while creating date2 dataset.
could someone please help.
data date (drop = date final);
date = "12Jan21:06:30:00";
final = "12Jan21:22:30:00";
daten = input(date,datetime18.);
finaln = input(final,datetime18.);
dt = finaln;
format daten finaln datetime18.;
run;
%let dt = %eval(1926109800);
data date2;
set date;
do until (result ge &dt.) ;
result = daten + (40*60) ;
output;
end;
format result datetime18.;
run;
Since you are just repeatedly adding to daten, the value of result is always constant.
I think you should put the initial value at the beginning and add it to the result.
data date2;
set date;
result=daten;/* add this statement */
do until (result ge &dt.) ;
result = result + (40*60) ;/* change variables from daten to result*/
output;
end;
format result datetime18.;
run;
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.