Im pulling this table in SAS EG and this is the code im using
DATA DOV_NEW;
SET DOV_SUMM_RCOC;
IF RCOC_GRP = 'NEW' THEN;
DO;
TRIGGER = 1;
NUMERATOR = COUNTER;
DENOMINATOR = 1;
METRIC = 'NEW Apts ';
IF RCOC_GRP NE 'NEW' THEN DELETE;
KEEP RESID MTH_YR I FAC CLINIC HOME_DEPT TRIGGER NUMERATOR DENOMINATOR METRIC;
where resid= '2972926';
OUTPUT DOV_NEW;
END;
RUN;
However I want to the sum the NUMERATOR for the same Mth-yr and Clinic but do not want to sum the DENOMINATOR
Example line 26 and 27 have the same Mth_yr, clinic and etc but the FAC are different i want the sum of 26 and 27 to be 174 and denominator to be just 1
Is that something i can do?
Why not use one of the summary tasks?
Otherwise, PROC MEANS and SUMMARY are also options to summarize your data:
*Create summary statistics for a dataset by a 'grouping' variable and store it in a dataset;
*Generate sample fake data;
data have;
input ID feature1 feature2 feature3;
cards;
1 7.72 5.43 4.35
1 5.54 2.25 8.22
1 4.43 6.75 2.22
1 3.22 3.21 7.31
2 6.72 2.86 6.11
2 5.89 4.25 5.25
2 3.43 7.30 8.21
2 1.22 3.55 6.55
;
run;
*Create summary data;
proc means data=have noprint;
by id;
var feature1-feature3;
output out=want median= var= mean= /autoname;
run;
*Show for display;
proc print data=want;
run;
If you need more specific help, please post data as a data step, I'm not typing data from a picture.
Nothing in your code shows you calculating a SUM either...
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.