Hello everyone, hope you're all good! I'm having some trouble figuring how to make SAS make some things to me. Lemme show you my code so i can talk about what i mean: DATA analise2014;
infile cards dlm='09'x dsd truncover;
input nnecropsia (a b c d e ) (:time.);
format a--e time8.;
CARDS;
1 16:10:00 17:24:00 19:02:00 08:15:00 09:59:00
2 15:39:00 18:19:00 20:01:00 08:15:00 11:02:00
3 12:10:00 19:41:00 20:38:00 10:00:00 12:43:00
4 05:10:00 08:41:00 09:56:00 10:30:00 12:45:00
RUN;
data need;
set analise2014;
a_to_b=ifn(b>a,b-a,'24:00:00't-a+b);
b_to_c=ifn(c>b,c-b,'24:00:00't-b+c);
c_to_d=ifn(d>c,d-c,'24:00:00't-c+d);
d_to_e=ifn(e>d,e-d,'24:00:00't-d+e);
format a_to_b -- d_to_e time8. ;
run;
proc tabulate data=need noseps;
var a_to_b -- d_to_e;
tables a_to_b--d_to_e , mean*f=time10.0;
run; So the first part of the code are a small part of my time samples and the code that makes SAS realize i'm dealing with time in the hh:mm:ss format. The second part of the code (data need) is the part where i ask SAS to show me how much time passed from one time to another (Example: a_to_b in the first line is 1:14:00, because 17:24:00 - 16:10:00 = 1:14:00, and the "ifn(b>a....) part is for times that pass trough midnight, as you can se in the third for the fourth collum, because if i dont use this code the time will come as a negative number. The third part of the code (proc tabulate) is so i can have an table with the arithmetic average of these diferences in time. Now i need another variable, that i'll call "f", what does "f" will be? I'm making this research for a necropsy lab, and they only receive corpses until 19h, and start doing the necropsies at 8h, and they want me to get the "effective residence time" with means discount 13 hours (19h to 8h are 13h) if any corpses arrived there after 19h PM. If you run the second part of the code, in the first line of c_to_d you'll see that it gives me 13:13:00, because thats the time that passed from 19:02:00 to 08:15:00, so "f" would subtract 13h from c_to_d and make it 00:13:00 (don't worry, it isn't manipulation of data as i will show both c_to_d and f in the results and the resume, it will serve as an argument of why i think the university [the place is subpart of one public university] should allow then to hire more staff and work 24/7). That part should not be that dificult, however if you look at the second line, there is this c_to_d that gives the result as 12:14:00 (08:15:00 - 20:01:00) and if i take this result and subtract 13h it will come as negative, so i need this subtraction to start at 19h and not in whatever time "c" is presenting me IF "c"≥19h, hope i could put it in a way that makes this easy to understand. Also, how do i make a graph of the third part of the code (the averages), one if i include "f" and one if i don't. Really hope you guys can help me, i thank you in advance.
... View more