Thursday, March 22, 2007

Cumulation of the data

%let name=200311+200312+200401+200402+200403+200404;

%let first_d=1031101+1031201+1040101+1040201+1040301+1040401;

%let last_d=1031201+1040101+1040201+1040301+1040401+1040501;
options mprint mlogic;

%macro peulot;

data nohesh.netunim_200311_200404;delete ;run;

%do i=1 %to 6;

proc sql;

connect to teradata

(user=xxx password=123 tdpid=DWPROD);

create table nohesh.peulot_%scan(&name,&i,+) as

select * from connection to teradata

(select branch_cust_ip,

count(*) as peulot

from bo_vall.V0500_1_FINANCIAL_EVENT as a,

bo_vall.VBM845_FINANCIAL_EVENT_CUST as b

where event_start_date ge %scan(&first_d,&i,+)

and event_start_date lt %scan(&last_d,&i,+)

and a.event_id=b.event_id

group by 1

);

disconnect from teradata;

quit;

data nohesh.netunim_200311_200404;

set nohesh.netunim_200311_200404

nohesh.peulot_%scan(&name,&i,+);

run;

%end;

%mend;

%peulot;

No comments: