Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Sat, 23 Dec 2006 @ 13:42:21 GMT

  <Prev Next>   <<First <Prev Next> Last>>  

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 probably did not notice my question or I missed out on his reply but if the std(x,y) only calculates the standard deviation between two numbers then Teradata has an easy equivalent:

std(x,y) = abs(y-x)/sqrt(2).



  <Prev Next>   <<First <Prev Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 28 Jun 2020