![]() Chapter Contents |
![]() Previous |
![]() Next |
| VARSTAT |
| Category: | Variable |
| Syntax | |
| Details | |
| Example | |
| See Also |
Syntax |
| rc=VARSTAT(table-id,varlist-1,statistics,varlist-2); |
| 0 | successful |
0 |
not successful |
Type: Numeric
Type: Numeric
Type: Character
Type: Character
Note: These parameters are update parameters. See
Input, Output, and Update Parameters for more information. ![[cautionend]](../common/images/cautend.gif)
Type: Numeric
| Statistic | Description | |
|---|---|---|
| CSS | sum of squares of a column's values, corrected for the mean | |
| CV | coefficient of variation of a column's values | |
| KURTOSIS | kurtosis of a column's values | |
| MAX | largest value for a column | |
| MEAN | mean of a nonmissing column's values | |
| MEDIAN | median value for a column | |
| MIN | smallest value for a column | |
| MODE | value with the most rows for a column | |
| N | number of rows on which calculations are based | |
| NMISS | number of rows with missing values | |
| NUNIQUE | number of rows having a unique value for a column | |
| RANGE | range of values for a column | |
| SKEWNESS | skewness of a column's values | |
| STD | standard deviation of a column's values | |
| STDERR | standard error of the mean | |
| SUM | sum of nonmissing column values | |
| USS | uncorrected sum of squares for a column | |
| VAR | variance of a column's values | |
| Details |
If more than one input column is specified with more than one statistic, then each statistic is calculated on all columns before the next statistic is calculated.
| Example |
Calculate the maximum, mean, and minimum values for the columns I and X from the table MY.NUMBERS:
tablename='my.numbers';
length imax xmax imean xmean xmin imin 8;
/* Declare the results as numeric. */
varname='i x';
numberid=open(tablename);
if (numberid=z0) then
do;
_msg_='Cannot open '||tablename;
return;
end;
statcode=varstat(numberid,varname,
'max mean min',imax,xmax,imean,xmean,imin,xmin);
put 'Column X';
put xmax= xmean= xmin=;
put 'Column I';
put imax= imean= imin=;
rc=close(numberid);
return;
| See Also |
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.