Hi, I have a particular scenario where I wanted to get the reverse of group by function. Here is the sample data Table 1 medication ndc rx_count total_qty Lipitor 59148000813 1 10 Lipitor 59148000813 1 10 Lipitor 59148000813 1 10 Lipitor 59148000813 1 10 Lipitor 59148000813 1 10 Lipitor 59148000813 1 10 Lipitor 59148000813 1 10 Lipitor 59148000813 1 10 Lipitor 59148000813 1 10 Lipitor 59148000813 1 10 Lipitor 59148000813 -1 -10 Lipitor 59148000813 1 10 If I do the summary using the below code PROC SQL; CREATE TABLE WORK.QUERY_FOR_TESTTEST AS SELECT t1.medication, t1.ndc, (SUM(t1.rx_count)) FORMAT=BEST12. AS SUM_of_rx_count, (SUM(t1.total_qty)) FORMAT=BEST12. AS SUM_of_total_qty FROM WORK.TESTTEST AS t1 GROUP BY t1.medication, t1.ndc; QUIT; I get the result as below. Table 2 medication ndc SUM_of_rx_count SUM_of_total_qty Lipitor 59148000813 10 100 Is there a way that I get the Table 1 as out put from table 2. Table 2 is the aggregated data, what I want is the extended as table 1. What would be the query I should use? Thanks, +Sathyan
... View more