Student Name | SchoolName | Location | NScore | EScore | MScore |
A | X | 5 | 1 | 2 | 1 |
B | X | 5 | 1 | 2 | 2 |
C | X | 5 | 2 | 2 | 2 |
D | X | 5 | 2 | 1 | 2 |
E | X | 5 | 1 | 1 | 1 |
F | X | 5 | 2 | 2 | 2 |
G | X | 5 | 2 | 2 | 2 |
H | Y | 5 | 2 | 2 | 2 |
I | Y | 5 | 2 | 2 | 1 |
J | Y | 5 | 2 | 4 | 3 |
K | Y | 5 | 1 | 3 | 2 |
L | Z | 5 | 4 | 2 | 1 |
M | Z | 5 | 5 | 2 | 3 |
N | Z | 5 | 1 | 1 | 1 |
O | Z | 5 | 2 | 1 | 2 |
P | Z | 5 | 3 | 2 | 1 |
Q | Z | 5 | 4 | 4 | 4 |
R | Z | 5 | 1 | 2 | 1 |
S | Z | 5 | 2 | 3 | 1 |
make a table that can display School Name, Location and mean score of NScore, EScore and MScore
for which
code
collapse (mean) NScore EScore Mscore Location, by(SchoolName)
works fine
And the resulting table looks Similar to
SchoolName | Location | NScore | EScore | MScore |
X | 5 | 2 (mean values) | 3 | 1 |
Y | 5 | 1 | 2 | 3 |
Z | 5 | 3 | 2 | 2 |
I was wondering if we can display number of students of each school in the table after which table will look similar to
SchoolName | Location | NoofStudents | NScore | EScore | MScore |
X | 5 | 7 | 2 | 3 | 1 |
Y | 5 | 4 | 1 | 2 | 3 |
Z | 5 | 8 | 3 | 2 | 2 |
0 Response to How will I be able to have a count of certain string variable when using collapse command ??
Post a Comment