|
Thanks Mr.Lars,
But as Mr. Peter assumed, I need to extract the last 3 calendar
months data including the current month, and the Data is not static.
everyday the warehouse is updated and an entry is made in this table.
I'm developing a JSP on which I'll display this Loading info for the
administrator.He needs to see the last 3 months Loading info(like
phase,date,duration).
I've done the same in the following fashion:
data track_test;
set WH.track;
where delta and date ne .;/*Client requirement*/
fini_d=put(datepart(date),yymms7.);
run;
proc sort data=track_test;
by descending fini_d;
run;
data track_test(keep=domain phase debut date delta fini_d);
set track_test;
by descending fini_d;
retain count 0;
if first.fini_d then count+1;
if count <=3;
run;
I'm getting my desired count of records.Thanks for Mr.Peter and
Mr.Lars for your suggestions.
Now , I'm in a complex situation where I've to retrieve Data in the
following fashion.
Every day, the data comes in a flat file and uploaded to warehouse.The
incoming flat file contains both production(FAB) and order(ORD) data.
The File may conatain data that has to be rejected due to Functional
issue or duplicate records.These rejected records will go to
respective tables(FAB_reject_Functional,FAB_Reject_Dup,ORD_reject_Functional,ORD_Reject_Dup).These
tables have a column called Upgrade_dt, which is the only common
column with 'date' in the abv 'track_test' table.
My need is , I've to take count(*) of rejects in FAB and ORD, for
every date present in 'track_test' table. the problem is FAB /ORD
reject tables are different in structure.So, I cannnot use a Proc
Append, and get a single reject table and retrieve the data. Based on
the Date Match, I need to add:-
Columns shd be present in 'track_test' tables:
The Domain - (eg, FAB or ORD).
Type of Reject - (Functional/Duplicate)
Count(*)
Can anybody help me in desingin an algorithm for this requirement? I
feel like I'm in a Maze! :)
Thanks in advance!
EasH
"LWn" <Lars.WahlgrenRemove@This.stat.lu.se> wrote in message news:<ca42ge$js3$1@news.lth.se>...
> Perhaps this could be a start
>
> data oct nov ;
> input phase $22. date datetime16. duration time14. ;
> format date datetime. duration time. ;
> if month(datepart(date))=10 then output oct ;
> if month(datepart(date))=11 then output nov ;
> datalines ;
> <yourdata>
> ;;;;
>
> HTH / LWn
>
> "Easwara Moorthy" <easwar_ps@yahoo.com> skrev i meddelandet
> news:dec29224.0406080117.7d8cea9e@posting.google.com...
> > Hi all,
> >
> > I've a dataset in the following format. I need to extract the data
> > for the last three months(May,april,March)...how shd I approach this
> > task?? please advice.
> >
> > Phase Date duration
> > ------------------------------------------------------
> > T9 10OCT03:12:04:31 0:00:01
> > LO 10OCT03:12:04:34 0:00:00
> > EadasdddON 16OCT03:14:31:33 0:00:00
> > decTION 16OCT03:15:32:35 0:00:02
> > GMT 29OCT03:18:35:55 0:05:08
> > EXTRACTION 30OCT03:17:54:37 0:00:21
> > T89 30OCT03:17:55:49 0:00:06
> > T2 30OCT03:17:56:16 0:00:06
> > LION 03NOV03:10:17:56 0:00:14
> > T11 03NOV03:10:18:46 0:00:04
> > T21 03NOV03:10:18:58 0:00:03
> > CHECK 07NOV03:08:46:02 0:00:08
> > .............
> > .............
> > LION 01JUN04:05:27:57 0:00:04
> > T231 01JUN04:05:30:00 0:00:00 (last updated
> > row)
> >
> > I need a solution urgently please!
> >
> > Thanks
> > Easwara
|