The code below works fine, the first part groups by date,fico,product, the second part does not group on fico, as I want it to be on the portfolio level, hence the variable 'Portfolio' as fico format=$9.
Is there a way to do this in one step without the union? I'd like to only have one 'from' statement. Pulling from the dataset twice doubles the time it takes to build this and I have many of them.
proc sql; create table avg_fico as select distinct intnx('month',OPEN_DT,0,'e') as OPEN_DT format=mmddyy10.,fico as fico,product,sum(cbscore_new) as cbscore_num,sum(n_cbscore_new) as cbscore_denom from mdj.uloc_format group by OPEN_DT,fico,product union select distinct intnx('month',OPEN_DT,0,'e') as OPEN_DT format=mmddyy10.,'Portfolio' as fico format=$9.,product,sum(cbscore_new) as cbscore_num,sum(n_cbscore_new) as cbscore_denom from mdj.uloc_format group by OPEN_DT,product order by OPEN_DT,fico,product;
... View more