I would like to know how to combine different SQL queries into one table.
The format should be
customer_no|TOTAL_DIFF_LASTPAYMENT_OPENED_dt|utilization trend| count_enquiry_recency_365|ratio_currbalance_creditlimit
I have two files with data (see data sample). I want to create a new table that contains the output of these PROC's.
Data sample: https://www.dropbox.com/sh/k7qz6m8w0yqenn7/AAAgYcVhHxCRNhiX5ZvK0q5Aa?dl=0
/* TOTAL_DIFF_LASTPAYMENT_OPENED_dt */
proc sql;
select customer_no, avg(TOTAL_DIFF_LASTPAYMENT_OPENED_dt)
from account_30_sort
group by customer_no ;
quit;
/* utilization trend */
proc sql;
select customer_no, sum (cur_balance_amt /creditlimit) / avg
(cur_balance_amt/(creditlimit+creditlimit))
from account_30_sort
group by customer_no;
quit;
/* count_enquiry_recency_365 */
DATA WORK.ENQUIRY_30;
SET ENQUIRY_30;
num_days= dt_opened - enquiry_dt;
RUN;
proc sql;
select customer_no, sum(enq_amt)
from ENQUIRY_30
where num_days <=365
group by customer_no;
quit;
/* ratio_currbalance_creditlimit */
proc sql;
select customer_no, sum( cur_balance_amt/ creditlimit)
from account_30
group by customer_no
;
quit;