Example 5 Let $f(x)$ be a function defined on $\mathbf{R}$, for any $x \in \mathbf{R}$, there are $\hat{j}(x+3) \leqslant f(x)+3$ and $f(x+2) \geqslant f(x)+2$, let $g(x)=f(x)-x$.
(1) Prove that $g(x)$ is a periodic function; (2) If $f(994)=992$, find $f(2008)$.

Translate the above text into English, please keep the original text's line breaks and format, and output the translation result directly.
Proof (1): Given $g(x)=f(x)-x$, we have
$$
\begin{array}{l}
g(x+2)=f(x+2)-x-2, \\
g(x+3)=f(x+3)-x-3 .
\end{array}
$$

By substituting $f(x+3) \leqslant f(x)+3$ and $f(x+2) \geqslant f(x)+2$, we get
$$
\begin{array}{l}
g(x+2) \geqslant f(x)+2-x-2=f(x)-x, \\
g(x+3) \leqslant f(x)+3-x-3=f(x)-x ;
\end{array}
$$

From (1), we have
$$
\begin{array}{l}
g(x+4) \geqslant f(x+2)-x-2 \geqslant f(x)+2-x-2=f(x)-x, \\
g(x+6) \geqslant f(x+2)-x-2 \geqslant f(x)+2-x-2=f(x)-x,
\end{array}
$$

From (2), we have $g(x+6) \leqslant f(x+3)-x-3 \leqslant f(x)-x$.
From (3) and (4), we get $g(x+6)=f(x)-x=g(x)$, so $g(x)$ is a periodic function with a period of 6.
(2) Solution: $2008-994=1014$ is a multiple of 6,
so $g(2008)=g(994)$,
which means $f(2008)-2008=f(994)-994$,
thus $f(2008)=f(994)+1014=2006$.
Note: The basis for the proof using inequalities is: if $A \leqslant B \leqslant A$, then $A=B$.