模型自由度和矩阵的秩休戚相关。Here lists three ways to compute the matrix rank. People suggest avoid using inverse matrix (in Method 2) because it is computation expensive. The Method 3 is for square matrix basically, but it could occasionally give a wrong result when the matrix is not squared. The code is compied and executed in SAS/IML Studio 3.4 with SAS version 9.3. Bascially, IML studio covers all from PRO IML and even more.... Jingju http://blog.sina.com.cn/s/blog_a3a92636010157rl.html