  Let $R$ be a real closed field and let ${\mathcal S}(M)$ be the ring of
(continuous) semialgebraic functions on a semialgebraic set $M\subset R^n$ and
let ${\mathcal S}^*(M)$ be its subring of bounded semialgebraic functions. In
this work we introduce the concept of \em semialgebraic depth \em of a prime
ideal $\gtp$ of ${\mathcal S}(M)$ in order to provide an elementary proof of
the finiteness of the Krull dimension of the rings ${\mathcal S}(M)$ and
${\mathcal S}^*(M)$, inspired in the classical way of doing to compute the
dimension of a ring of polynomials on a complex algebraic set and without
involving the sophisticated machinery of real spectra. We also show that
$\dim{\mathcal S}(M)=\dim{\mathcal S}^*(M)=\dim M$ and we prove that in both
cases the height of a maximal ideal corresponding to a point $p\in M$ coincides
with the local dimension of $M$ at $p$. In case $\gtp$ is a prime \em $z$-ideal
\em of ${\mathcal S}(M)$, its semialgebraic depth coincides with the
transcendence degree over $R$ of the real closed field $\qf({\mathcal
S}(M)/\gtp)$.
