CV Function
Returns the coefficient of variation.
| Category: | Descriptive Statistics |
|---|---|
| Returned data type: | DOUBLE |
Table of Contents
Syntax
Required Argument
expression
specifies any valid expression that evaluates to a numeric value.
| Requirement | At least two arguments are required. |
|---|---|
| Data type | DOUBLE |
| See | DS2 Expressions in SAS DS2 Programmer’s Guide |
Example
The following program illustrates the CV function:
Note: In this example, DS2 statements are sent to SAS
using PROC DS2.
proc ds2;
data test(overwrite=yes);
dcl double x1 x2 x3 x4;
method run();
x1=cv(5, 9, 3, 6);
put x1=;
x2=cv(5, 8, 9, 6, .);
put x2=;
x3=cv(8, 9, 6, .);
put x3=;
x4=cv(of x1-x3);
put x4=;
end;
enddata;
run;
quit;
SAS writes the following output to the log.
x1=43.4782608695652 x2=26.082026547865 x3=19.9242421519819 x4=40.9535392160926
Last updated: September 2, 2026