BookmarkSubscribeRSS Feed
hk2013
Fluorite | Level 6

Untitled picture117.png

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? 

1 REPLY 1
Reeza
Super User

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...

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 654 views
  • 0 likes
  • 2 in conversation