Computing More than One Statistic - SAS Programming

If you have more than one variable in your VAR list, the variable names in the OUTPUT statement following the N=, MEAN=, SUM=,etc. represent the variables in the output data set that contain the values of that statistic for each of the variables in the VAR list in the order in which they are listed.

A procedure to create an output data set STATS containing the number of observations, means, and sums from a data set ORIGDATA containing CLASS variables A and B and analysis variables X, Y, and Z,is shown here:

Example

PROC MEANS DATA^ORIGDATA?
CLASS A B;
VAR X Y Z;
OUTPUT OUT =STATS
N *NUMJC NUM_Y NUM_Z
MEAN=MEAN_X MEAN_Y MEAN_Z
SUM =TOTJC TOT_Y TOTJSj
RUN;

The variables NUM_X,NUM_Y, and NUM_Z in the output data set STATS contain the values for the number of nonmissing observations for the variables X, Y, and Z; the variables MEAN_X,MEAN_Y, and MEAN_Z contain the means for X, Y, and Z; the variables TOT_X,TOT_Y, and TOT_Z contain the sums of the three variables X, Y, and Z. Note that _FREQ_indicates the total number of observations, while the variable(s) created with the N= option counts only nonmissing observations.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

SAS Programming Topics