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

What is the difference between %put and symbolgen? : sas-macro

660


what is slowly changing dimension? : Sas-di

613


What can you learn from the SAS log when debugging?

910


what is scheduling and how will u implement it. In scheduling 5 jobs r running if there is an error occured at 3rd job and how will u check and waht necessary steps will u take not to repeat the same mistake

1907


What is the use of PROC gplot?

629






If you have a dataset that contains 100 variables, but you need only five of those, what is the code to force SAS to use only those variables?

694


how to create the AE dataset by using SDTMIG specifications and SAP plan by using UNIX platform?

2283


What Proc glm does?

599


What is factor analysis?

651


What is the SAS data set?

669


what r the job openings SAS for fresher graduates !

2007


What is the difference between reading data from an external file and reading data from an existing data set?

628


explain about data integrator metadata reports? : Sas-di

554


Name validation tools used in SAS

681


what is factor analysis? : Sas-administrator

600