|
|
Archives of the TeradataForum
Message Posted: Wed, 20 Dec 2006 @ 12:48:20 GMT
Subj: | | Re: Standard deviation for multiple columns |
|
From: | | Victor Sokovin |
| I don't think there is a Teradata equivalent. Both stddev_samp and stddev_pop are Teradata "aggregate" functions, while the STD data step
function in SAS operates on *values*, not columns. In other words, std(x,y) returns the standard deviation of the two current values of x and y
*for each row*, i.e.: | |
> proc sql;
> select x, y, std(x,y) as std_x_y
> from mytable;
> quit;
> x y std_x_y
> -------- ------- --------
> 1 2 0.707107
> 2 3 0.707107
> 4 5 0.707107
> 6 7 0.707107
| If you REALLY need to find the standard deviation of different columns taken as one series, I suppose you can UNION each column into one
derived table, such as: | |
> Select stddev_samp(x)
> >From (select x from table union all select y from table)
Bob, I did that but stddev_samp was 2.12 in this example, which does not seem to match the SAS std_x_y.
I think in your SAS procedure you calculated (for each row) the standard deviation between two consecutive integers. This does not really show
us what the SAS std(x,y) is supposed to do with more interesting examples, does it?
Regards,
Victor
| |