In the general case I think it's easier to consider the matrix in the form
$$
M = \sum_{i_1,\dots,i_n, j_1, \dots j_n} c_{i_1,\dots,j_n} |i_1 \dots i_n\rangle \langle j_1 \dots j_n|,
$$
where the $i_1, \dots, i_n,j_1, \dots, j_n$ are all binary and the $c$ with the awful index are the elements of the matrix. Now we know the transformation rules so it's not too hard to indicate which coefficients should be zero and which should be one. (I've labelled the systems $1$ to $n$ for brevity as $n-1$ is a big subscript). Now suppose we want to swap system $p$ with system $q$ where $1 \leq p < q \leq n$. We know exactly what transformation we are after so it shouldn't be too difficult to write down the transformation in the above form.
We know that if our state is $|i_1 \dots i_p \dots i_q \dots i_n\rangle$ then we want the map to output the state $|i_1 \dots i_q \dots i_p \dots i_n \rangle$. Well such a map is precisely defined by
$$
\begin{aligned}
\mathrm{SWAP}_{p,q} &= \sum_{i_1,\dots,i_n} |i_1\dots i_q \dots i_p \dots i_n\rangle \langle i_1 \dots i_p \dots i_q \dots i_n| \\&= \sum_{i_1, \dots,i_n} |i_1\rangle\langle i_1|\otimes \dots \otimes |i_q\rangle \langle i_p |\otimes \dots \otimes |i_p \rangle \langle i_q| \otimes \dots \otimes |i_n\rangle \langle i_n|.
\end{aligned}
$$
With this form we immediately know the entries of the matrix which are ones (the rest are zero). Then you have to translate this form into the matrix, if $n$ is small then you can do this by hand but it general I would write some code to generate this matrix. For example, the following (written in Mathematica) should generate the swap matrix for swapping subsystems two and three in a three qubit system.
outer[i_, j_] :=
Transpose[{UnitVector[2, i + 1]}].{UnitVector[2, j + 1]};
(* Let's swap systems 2 and 3 in a 3 qubit system *)
M = ConstantArray[0, {8, 8}];
For[i1 = 0, i1 <= 1, i1++,
For[i2 = 0, i2 <= 1, i2++,
For[i3 = 0, i3 <= 1, i3++,
M = M +
KroneckerProduct[outer[i1, i1] , outer[i3, i2],
outer[i2, i3]];
]
]
];
M // MatrixForm
This outputs
$$
\left(
\begin{array}{cccccccc}
1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\
0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\
\end{array}
\right).
$$
which is what we expect $I \otimes \mathrm{SWAP}$ (do nothing on the first system and do a two qubit swap on the second and third systems).