Hi @Tom and @ballardw , Thank you for the information and your replies. I have tried both codes and I am still doing something wrong but I am not sure exactly what. Here is the SAS codes I have tried: data DISEASE_ERT;
/* SAS datetime values*/
dd2 = input(DISEASEAD2,anydtdtm30.);
dd1 = input(DISEASEAD1,anydtdtm30.);
/* format so human readable*/
format dd2 dd1 datetime20.;
seconds = dd2-dd1;
minutes = intck('minute',dd1,dd2,'c');
hours = intck('hour',dd1,dd2,'c');
days = intck('dtday',dd1,dd2,'c');
run; and also ... data DISEASE_ERT;
dt1= input(DISEASEAD1,datetime19.);
dt2= input(DISEASEAD2,datetime19.);
duration = dt2 - dt1;
format dt1 dt2 datetime19. duration time12.;
put (_all_) (=/);
run; Here is my SAS Log: 1124 data DISEASE_ERT;
1125 /* SAS datetime values*/
1126 dd2 = input(DISEASEAD2,anydtdtm30.);
1127 dd1 = input(DISEASEAD1,anydtdtm30.);
1128 /* format so human readable*/
1129 format dd2 dd1 datetime20.;
1130 seconds = dd2-dd1;
1131 minutes = intck('minute',dd1,dd2,'c');
1132 hours = intck('hour',dd1,dd2,'c');
1133 days = intck('dtday',dd1,dd2,'c');
1134 run;
NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
1126:16 1127:16
NOTE: Variable DISEASEAD2 is uninitialized.
NOTE: Variable DISEASEAD1 is uninitialized.
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line):(Column).
1 at 1130:17 1 at 1131:14 1 at 1132:12 1 at 1133:12
NOTE: The data set WORK.DISEASE_ERT has 1 observations and 8 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds Apologies, I am on a huge learning curve and I am trying not to give up. Thanks in advance, T.
... View more