Below is the table.









Required to be output should be the highest number of each student_id.
Example.
Student_id Subject Marks
1 Hindi 86
2 Hindi 70
3 English 80
.

Calculate sum and average marks for each group of student_id
Example.
Student_id Subject Marks Total Marks Average
1 English 40 181 60.33333
2 English 67 196 65.33333
3 English 80 160 53.33333

PLEASE PROVIDE THE CODE OF ABOVE PROBLEMS

Answer Posted / chaudhary_1989

data a;
input id sub$ marks;
cards;
1 Hindi 86
2 Hindi 70
3 Hindi 80
1 English 80
2 English 34
3 English 39
1 Maths 28
2 Maths 45
3 Maths 12
;
run;

proc sort data = a out=b;
by id descending marks;
run;

data c (drop=total_marks) d;
set b;
by id descending marks;
if first.id then output c;
if first.id then total_marks=marks;
else total_marks+marks;
if last.id then output d;
run;

proc print; run;

proc means data = a mean max sum;
class id;
var marks;
output out=df;
run;

proc means data = a noprint nway;
class id;
var marks;
output out=df sum= mean= max= /autoname;
run;

proc print; run;

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

do you prefer proc report or proc tabulate? Why? : Sas programming

660


what do the pad and dim functions do? : Sas programming

656


What do the mod and int function do? : Sas programming

687


How to limit decimal places for the variable using proc means?

698


What are the applications primarily used by business analyst? : Sas-bi

643






what is the primary data source for the wrs? : Sas-bi

764


what is sas enterprise intelligence architecture? : Sas-bi

639


Mention the difference between ceil and floor functions in sas?

758


what do the sas log messages "numeric values have been converted to character" mean? What are the implications? : Sas programming

785


How do dates work in SAS data?

779


How would you define the end of a macro? : sas-macro

717


which date functions advances a date time or date/time value by a given interval? : Sas programming

625


How to specify variables to be processed by the freq procedure?

715


What does the RUN statement do?

949


What is SAS?

710