Use the MATLAB function speye to represent the identity matrix. For more on sparse matrix, you can refer to Saad's monograph (Chapter 3) to see how the sparse matrix is stored:
Y. Saad, Iterative methods for sparse linear systems. Siam, 2003, which can be downloaded from his homepage (http://www-users.cs.umn.edu/~saad/toc.pdf).
If you need to do certain matrix computations with the complement of S (denoted by D), then it is usually unnecessary to form D explicitly; for instance, a matrix-vector product D*v only requires one Matrix-Vector product with S, that is, D*v=v-S*v. In this sense, you can write a subroutine that only requires S as an input to solve your problem.