In this paper a Canonical Correlation Analysis (CCA) is used to test the hypothesis r = r0 against the alternative r < r0. Such a test flips the null and alternative hypotheses of Johansen's LR test and can be used jointly with the LR test to construct a confidence set for the cointegration rank. As the latter test, our tests are based on the eigenvalues of a CCA between differences and lagged levels of a time series vector. The resulting test statistics can easily be adjusted for nuisance parameters using a nonparametric correction in the spirit of Phillips (1987, 1995). Monte Carlo simulations suggest that variants of the CCA statistic may have better properties than alternative tests and can be used as an alternative to Johansen's LR tests for determining the cointegration rank.