Have you used multivariate procedures in SAS and wanted to save out scores? Some procedures, such as FACTOR, CANDISC, CANCORR, PRINCOMP, and others have an OUT= option to save scores to the input data set. However, to score a new data set, or to perform scoring with multivariate procedures that do not have an OUT= option you need another way.
Scoring new data with these procedures is a snap if you know how to use PROC SCORE. The OUTSTAT data sets from these procedures includes scoring code that the procedure uses to score observations in the DATA= data set. They are contained in the observations where TYPE='SCORE'.
The only catch, however, is that if you use a hierarchical method such as the VARCLUS procedure, then the score code is included for the 1-, 2-, 3-, and so on cluster solutions, up to the final number of clusters in the analysis. PROC SCORE doesn't know which one to use.
So you have one extra (teeny-tiny) step to perform scoring: Subset the code to only the NCL solution you want. Then, use the same VAR statement from PROC VARCLUS in PROC SCORE.
Here is an example:
The analysis has produced three clusters.
Here is a subset of the scorecode data set, which contains SCORE observations. The first column, NCL, indicates the number of clusters. You only want to score the three-cluster solution.
Whether you prefer to subset and replace the data, as shown here, or subset and create a new data table is up to you.
This code scores the original data set with the three cluster scores. You can use a different DATA= data set to score new data, as long as the variables are all there for scoring. Note that I used a VAR statement in PROC SCORE here, so that the procedure knows which subset of the columns in the scorecode are used for scoring. Otherwise, the NCL column would pose a problem.
Here are the new columns in the scored data set.