Date: Mon, 3 Oct 2005 12:17:59 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: PROC SQL Question
Does the initial ordering of rows within each JobName group have to be
preserved? If so, is there some variable which explicitly tracks that
ordering?
About the timestamps: Is it conceivable that a row will have a StartTime
before midnight and an EndTime after midnight and thus on a different
calendar day? If so, you won't like your computed RunTime results.
On Mon, 3 Oct 2005 08:30:04 -0400, Srna, Carol (C.) <csrna@FORD.COM> wrote:
>Hi All.
>
>Input data:
>
>JobName StartTime EndTime RunTime
>ABC 0111 0159
>48
>ABC 0106 0128
>22
>ABC 0333 0356
>23
>
>DEF 0110 0220
>10
>DEF 1400 1405
>05
>
>JKL 0800 0805
>05
>
>This is how I want the output to look:
>JobName StartTime EndTime RunTime
>ABC 0111 0159
>48
> 0106 0128
>22
> 0333 0356
>23
>
>DEF 0110 0220
>10
> 1400 1405
>05
>
>JKL 0800 0805
>05
>
>My Code:
> DATA ALL3;
> SET ALL2;
> JOBNAME=SUBSTR(PLINE,17,8);
> START=SUBSTR(PLINE,66,4);
> END=SUBSTR(PLINE,77,4);
> RUNTIME=END-START;
> RUN;
>
> PROC SQL;
> CREATE TABLE OUT1 AS
> SELECT JOBNAME, START, END, RUNTIME
> FROM ALL3
> GROUP BY JOBNAME;
> RUN;
>
> PROC PRINT;VAR JOBNAME START END RUNTIME;
> RUN;
>
>Do I need to create a TABLE?
>How do I use DISTINCT for variable JOBNAME only, and also SELECT the
>other variables for output?
>
>Bottom Line:
>How should this be done?
>
>TIA
|