| Date: | Fri, 21 Mar 2003 15:55:34 -0500 |
| Reply-To: | Howard_Schreier@ITA.DOC.GOV |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Howard_Schreier@ITA.DOC.GOV |
| Subject: | Re: Date & Time concatenation? |
|---|
As you know by now, there are several ways.
I would use a function. There is no DT function to directly build the
datetime value, along the lines of:
composite = dt(jdate,atime);
But you can use:
composite = dhms(jdate,0,0,atime);
This is equivalent to:
composite = dhms(jdate,hour(atime),minute(atime),second(atime));
which is more explicit and abstract.
On Fri, 21 Mar 2003 09:27:07 -0500, Keith McWhorter <kmcwhort@STATE.GA.US>
wrote:
>Hey,
>
>Be nice - I'm a SAS newbie! :-) I want to do a calculation on length of
>time, but since some of my observations cross midnight, I feel I need to
>have the date and time together to do the math. I've got about 5 SAS
>books open on my desk trying to feel my way through this program! (This
>is SAS 8.2 on OS/390 2.10)
>
>My input is this:
>
>DATA jobswait;
> INFILE 'SGSS.KEITH.ALLOC';
> INPUT @44 SYSID $4. @53 JDATE JULIAN5. @59 ATIME TIME11.2
> @71 JOBNO $8. @98 JobName $8.;
> IF JobName=: 'DMD';
> JNN = jobname || jobno;
>
>I'm then sorting on the new variable JNN. I want to take the first and
>last occurances and get the difference in the time (duration). I don't
>know how to combine my date and time to one variable to do the math on.
>
>For your enjoyment, here's the rest of the code as it is so far...
>
>PROC SORT data=jobswait;
> BY JNN atime;
>
>DATA jobsone;
> SET jobswait;
> BY JNN;
> RETAIN dur;
> IF first.jnn THEN DO;
> DUR = .;
> start = atime;
> END;
> IF last.jnn THEN DO;
> dur = SUM(atime - start);
> jname = substr(jnn,1,8);
> jno = substr(jnn,9,8);
> output;
> END;
>
>Can anyone help?
>Thanks!!!
>
>Keith McWhorter
>Georgia Technology Authority
>404-656-9068
|