BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
NagendraBS
Fluorite | Level 6

1.  I have a dataset need to summarize the dataset and update the records as specified.

data test;

input stud_id subject marks

datalines

1 A 40

1 B 35

1 B 40

1 C 30

1 C 33

1 C 40

1 D 50

2 A 45

2 B 30

2 B 40

2 C 50

2 D 30

2 D 50

REQUIRED OUTPUT

STUD_ID SUBJECT MARKS

1     A     40

1     B     40

1     C     40

1     D     50

2     A     45

2     B      40

2     C     50

2     D     50

Note: student may fails and re writes the exams and gets pass for second or third time. Here latest marks(last attempt) to the particular subject for each student need to get updated on suject.

1 ACCEPTED SOLUTION

Accepted Solutions
mohamed_zaki
Barite | Level 11

Based on that the data set is sorted:

data test;

input stud_id subject $ marks;

datalines;

1 A 40

1 B 35

1 B 40

1 C 30

1 C 33

1 C 40

1 D 50

2 A 45

2 B 30

2 B 40

2 C 50

2 D 30

2 D 50

;

data new;

set test;

by stud_id subject;

if last.subject;

run;

View solution in original post

2 REPLIES 2
mohamed_zaki
Barite | Level 11

Based on that the data set is sorted:

data test;

input stud_id subject $ marks;

datalines;

1 A 40

1 B 35

1 B 40

1 C 30

1 C 33

1 C 40

1 D 50

2 A 45

2 B 30

2 B 40

2 C 50

2 D 30

2 D 50

;

data new;

set test;

by stud_id subject;

if last.subject;

run;

Loko
Barite | Level 11


Hello,

data have;
input stud_id subject $ marks;
datalines;
1 A 40
1 B 35
1 B 40
1 C 30
1 C 33
1 C 40
1 D 50
2 A 45
2 B 30
2 B 40
2 C 50
2 D 30
2 D 50
;

proc means data=have noprint nway ;
class stud_id subject;
var marks;
output out=maximum(drop=_freq_ _type_) max=marks;
run;

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!
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 845 views
  • 0 likes
  • 3 in conversation