Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: making new variables for each obs


From   Daniel Egan <[email protected]>
To   [email protected]
Subject   Re: st: making new variables for each obs
Date   Tue, 25 Jan 2005 09:35:21 -0500

Hello, 

On Tue, 25 Jan 2005 22:44:16 +0900, 김병모(Byungmo Kim)
<[email protected]> wrote:
> Dear All
> 
> I'd like to make vars of standard deviation of sequential 10 variables.
>                                                                                       new variables
>                                                                                         -----------
>   standard deviation of 10 variables  ( for v1 to v10 )  -->   std1
>   standard deviation of 10 variables  ( for v2 to v11 ) -->    std2
>   standard deviation of 10 variables  ( for v3 to v12 ) -->    std3
>    .
>    .
>    .
>    .
>   standard deviation of 10 variables  ( for v11 to v20 ) -->  std11


this can be done using "row standard deviations" of the -egen- function. 


egen std1=rsd(v1-v10)
egen std2=rsd(v2-v11)
egen std3=rsd(v3-v12)

Just make sure your variables v1-v12 are in order. 

Cheers, 

Dan

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index