Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: single elements of varlist
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: single elements of varlist
Date
Mon, 28 Mar 2011 09:03:50 +0100
program myprog, rclass
syntax varlist(numeric min=3) [if] [in]
tokenize
> get the mean of variable 1
> get the median of variable 2
> get the standard deviation of variable 3
> return scalar results=(sum of the previous three values)
On Mon, Mar 28, 2011 at 8:53 AM, [email protected]
<[email protected]> wrote:
> Dear Statalist,
>
> I am new to programming and I have a basic problem. I need to refer to the
> single variables in "varlist" and I am not sure how. For example, I might to
> get the sum of: the mean of the first variable, the median of the second
> variable and the standard deviation of the third variable.
>
> Thanks a lot for any feedback,
>
> Andrea
>
>
>
> program define myprog, rclass
> syntax varlist
> get the mean of variable 1
> get the median of variable 2
> get the standard deviation of variable 3
> return scalar results=(sum of the previous three values)
>
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/