Showing posts with label macro. Show all posts
Showing posts with label macro. Show all posts

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;

Monday, August 28, 2006

Sas macro format

текст

DATA _NULL_;
FILE PRINT;
RUN;
%MACRO FORMAT(VAL=VAL,LOW=,START=,STOP=,COUNT=);
PROC FORMAT;
VALUE &VAL
%DO X=&START %TO &STOP %BY &COUNT;
%LET Y=%SYSEVALF(&X-5/10);
&LOW<-&Y="&LOW-&Y"
%LET LOW=%SYSEVALF(&Y+5/10);
%PUT &LOW;
%END;
;
%MEND FORMAT;

%FORMAT(LOW=0,START=1,STOP=5,COUNT=1) ;

data next;
DO VALUE=1 TO 5 BY 0.05;
OUTPUT;
END;
run;

proc print;
format value val.;
RUN;