  We investigate a stochastic optimal control problem where the controlled
system is depicted as a stochastic differential delayed equation; however, at
the terminal time, the state is constrained in a convex set. We firstly
introduce an equivalent backward delayed system depicted as a time-delayed
backward stochastic differential equation. Then a stochastic maximum principle
is obtained by virtue of Ekeland's variational principle. Finally, applications
to a state constrained stochastic delayed linear-quadratic control model and a
production-consumption choice problem are studied to illustrate the main
obtained result.
