Emmmm.Since you want dataset like that,It needs some more code,and process is much more complicated.
See whether it is what you want;
[pre]
data one;
input School $ Month $ StudentName $ Subject $ Test1 Test2 Test3 Test4 Total;
datalines;
ABC July-10 John Math 90 79 86 99 354
ABC July-10 John Science 92 89 99 91 371
ABC July-10 John History 78 69 82 79 308
ABC July-10 John English 81 79 83 82 325
ABC July-10 Becky Math 92 77 76 88 333
ABC July-10 Becky Science 67 76 65 83 291
ABC July-10 Becky History 78 69 76 79 302
ABC July-10 Becky English 90 79 80 81 330
ABC Dec-10 John Math 97 93 89 99 378
ABC Dec-10 John Science 80 89 92 91 352
ABC Dec-10 John History 70 77 76 80 303
ABC Dec-10 John English 80 69 78 81 308
ABC Dec-10 Becky Math 80 70 67 82 299
ABC Dec-10 Becky Science 78 73 66 76 293
ABC Dec-10 Becky History 87 77 79 74 317
ABC Dec-10 Becky English 79 72 84 81 316
;
run;
data temp;
set one;
length _test $ 10;
array test{*} test: total;
do i=1 to dim(test);
_test=vname(test{i});
_value=test{i};
output;
end;
drop test: total i;
run;
proc sort data=temp;
by _test subject studentname;
run;
data op;
set temp;
by _test subject studentname;
length _month value $ 50;
retain _month value;
if first.studentname then call missing (_month ,value);
_month=catx(' ',_month,month);
value=catx(' ',value,_value);
if last.studentname then output;
drop _value month ;
run;
data want;
set op;
length row $ 50;
if _test ne lag(_test) then do;row=_test;output; end;
if subject ne lag(subject) then do;row=catx(' ',subject,_month); output; end;
row=catx(' ',studentname,value);output;
keep row;
run;
[/pre]
Ksharp
Message was edited by: Ksharp
Message was edited by: Ksharp