Hi, I'm trying to aggregate individual purchase data. The data set contains all information about where, when, and what each individual purchased a product. It consists of more than 10 columns. When I used code to aggregate the data, I get only 6 columns (id, week, retailer, product_code, quantity, total_price). However, I want to keep all other columns as well. To keep all columns, I used . I wonder if it is a right approach. Unfortunately, and have different results with different numbers of rows. How can I solve this problem? Jason proc sql; create table work.Panel_purchase as select id, week, retailer, product_code, sum(quantity) as quantity, sum(total_price) as total_price from work.Purchase_all group by id, week, retailer, product_code order by id, week, retailer, product_code; quit; proc sql; create table work.Panel_purchase as select *, sum(quantity) as quantity, sum(total_price) as total_price from work.Purchase_all group by id, week, retailer, product_code order by id, week, retailer, product_code; quit; proc sort data=Work.Panel_purchase out=Work.Panel_purchase nodupkey; by id week retailer product_code quantity total_price_paid; run;
... View more