Hi All, the below is my have dataset. for each subject ha multiple vis and each vis have dos. i want to create ddos, wkdos ddos is nothing but , dos having at that particular vis, wdos is sum of ddos in that paricular vis cumdos is sum of wdos, maxwkdos and minwkdos are max and minimum value of wdos Have: sub vis dos 100 WEEK 1 5 100 WEEK 1 5 100 WEEK 1 5 100 WEEK 2 100 WEEK 2 5 100 WEEK 2 5 100 WEEK 3 5 100 WEEK 3 5 100 WEEK 3 5 100 WEEK 4 5 100 WEEK 4 100 WEEK 4 5 100 WEEK 5 5 100 WEEK 5 5 100 WEEK 5 Want: sub group vis final 100 DDOS WEEK 1 5.000 100 DDOS WEEK 1 5.000 100 DDOS WEEK 1 5.000 100 WDOS WEEK 1 15.000 100 DDOS WEEK 2 100 DDOS WEEK 2 5.000 100 DDOS WEEK 2 5.000 100 WDOS WEEK 2 10.000 100 DDOS WEEK 3 5.000 100 DDOS WEEK 3 5.000 100 DDOS WEEK 3 5.000 100 WDOS WEEK 3 15.000 100 DDOS WEEK 4 5.000 100 DDOS WEEK 4 100 DDOS WEEK 4 5.000 100 WDOS WEEK 4 10.000 100 DDOS WEEK 5 5.000 100 DDOS WEEK 5 5.000 100 DDOS WEEK 5 100 WDOS WEEK 5 10.000 100 CUMDOS 60.000 100 MAXWKDOS 15.000 100 MINWKDOS 10.000 my code: proc sql; create table want as select distinct sub,vis,sum(dos) as final,'WDOS' as group from have group by sub,vis order by sub, final; quit; this way i am creating separately for all group parameters, any better way like keep a macro or using array or dataset to achieve want Thank you sam
... View more