data _null_;
today=today();
year=year(today);
this_week=week(today)-1;
call symput( 'currentyear', year);
call symput('this_week', this_week);
run;
proc sql;
connect to oracle as oracle_tables
(user = USERID orapw = PASSWORD path ="INSTANCE");
create table test as
select * from connection to oracle_tables
(select * from abc.table
where complete_year in (¤tyear)
and complete_week in (&this_week));
disconnect from oracle_tables;
quit;
表中包含很多列,都需要通过pass through facility拿到。日期方面包括详细完成的日期,年份,星期等。我现在想到的方法可以拿到上一周的周日到周六的所有交易,但是一旦跨年了就有个小bug,每年第一周的时候this_week=0,会报错。悬赏看下大家怎么制作周度报表,尤其是怎么解决一周两三天在上一年,其它三四天在新年。