Re-arranging SAS data

#1
I have data in this format:
Admit Gender Department Count
Admitted Male A 512
Rejected Male A 313
Admitted Female A 89
Rejected Female A 19
Admitted Male B 353
Rejected Male B 207
Admitted Female B 17
Rejected Female B 8
Admitted Male C 120

And, I want to re-arrange it in a single data step loop (Suggested tools: MOD function, _N_ automatic variable, DROP statement, OUTPUT statement, and SELECT-WHEN construct) such that it looks like this:

Department, Males Admitted, Males Rejected, Females Admitted, Females Rejected.

A 512 313 89 19
B 353 207 17 8
C 120 205 202 391
D 138 279 131 244
E 53 138 94 299
F 22 351 24 317


Could someone please help me with the problem. I am lost ....
 

vinux

Dark Knight
#6
I am required to do this using the DATA STEP approach and not via proc transpose.
That is not difficult in your case.
Hint:
Make four data sets using if and output ( like if admit= & gender = then output..). Rename the variable and join the datasets