dimanche 25 avril 2021

How to generate random time in SAS and get time difference?

I am very new to SAS Programming. I have to create two variables for working hour calculation. I also have to use random time for this task. Here is what I have tried...

DATA wh;
in_1 = 28800;
in_2 = 36000;
out_1 = 18000;
out_2 = 25200;

DO i=1 TO 5;
  time_in = RAND("UNIFORM", in_1, in_2);
  time_out = RAND("UNIFORM", out_1, out_2);

  working_hour = INTCK('HOUR', time_out, time_in);
OUTPUT;
END;
RUN;

The random time generator works fine, but the INTCK function does not return expected values. I know it may be very silly. But I am stuck :(




Aucun commentaire:

Enregistrer un commentaire