The differ with respect to the way they deal with missing values. To
compute a correlation you just need two variables, so if you ask for a
matrix of correlations you could just do so by looking at each pair of
variables separately and inlcude all observations that contain valid
values for that pair. Alternatively, you could say that the entire
list of variables defines your sample, in that case would first remove
all observations that contain a missing value on any of the variables
in the list of variables. -pwcorr- does the former and -corr- does the
latter. In the example below, the variable rep78 is the only variable
with missing values. So -corr- will compute the correlation between
price and trunk on only those observations with valid values on rep78
price and trunk, while -pwcorr- will compute the correlation between
price and trunk on those observations with valid values on price and
trunk. You can use the -if- condition to let -pwcorr- behave like
-corr-.
*------------------ begin example ------------------
sysuse auto
corr By default, correlations are computed based on the number of rows with non-missing data for the variables listed after the corr command (listwise deletion of missing data). The pwcorr command can be used to request that correlations be computed in a pairwise fashion, meaning that all of the available data for each pair of variables will be used to compute the correlation. This means that a different number of observations may be used in the calculation of the correlation coefficients for each pair of variables.