1

I have a 'Proc SQL' query:

%macro customers_metrics (me_dt, month_end);
PROC SQL;
CREATE TABLE raw.&month_end.  AS
select * from table
where eff_date <= &me_dt. AND end_date >= &me_dt.;
quit;
%mend;
%customers_metrics('2018-01-31', jan_18);
%customers_metrics('2018-02-28', feb_18);
%customers_metrics('2018-03-31', mar_18);
%customers_metrics('2018-04-30', apr_18);
%customers_metrics('2018-05-31', may_18);
%customers_metrics('2018-06-30', jun_18);
%customers_metrics('2018-07-31', jul_18);
%customers_metrics('2018-08-31', aug_18);
%customers_metrics('2018-09-30', sep_18);
%customers_metrics('2018-10-31', oct_18);
%customers_metrics('2018-11-30', nov_18);
%customers_metrics('2018-12-31', dec_18);

The output created 12 tables for each month using proc SQL.

I am trying to run this in hive SQL now, but I could not find any parallel macro function in hive SQL. Is there another way around for making it work in as a hive query and create 12 tables at month level?

Sowndarya
  • 97
  • 1
  • 15
Aket Lohia
  • 31
  • 2

0 Answers0