Hi. I have the following Proc SQL that sums variables at the active_description level. Is there a way to also get an overall activity_description total by pay_data_month in the same query? I seem to remember SQL has some sort up roll up functionality. File attachment shows the current output. So the desired output would have an additional row after each grouping of pay_data_month with a sub total for all activities.
Any help here would be great. Thanks so much.
PROC SQL;
CREATE TABLE &SITE._HCR_PD_ACTVTY_SUM AS
SELECT PAY_DATA_MONTH
, AREA
, HCRID
, ACTIVITY_DESCRIPTION
, SUM(PAY_AMOUNT) FORMAT DOLLAR15.2 AS MNTHLY_PAY_AMNT
, SUM(RATE) AS MNTHLY_RATE
, SUM(UNITS) FORMAT 15.2 AS MNTHLY_UNITS
FROM &SITE._HCR_PD
WHERE HCRID='65036'
GROUP BY PAY_DATA_MONTH
,AREA
,HCRID
,ACTIVITY_DESCRIPTION
;QUIT;
... View more