Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: Create a Dummy Based on Standard Deviation

 From Nick Cox To statalist@hsphsun2.harvard.edu Subject Re: st: Create a Dummy Based on Standard Deviation Date Tue, 11 Sep 2012 07:47:10 +0100

```This sounds like a strange idea: you have precise information on a
variable, so why not use it?

But the Stata syntax could be something like

gen within = inrange(X, 14, 22)

SJ-6-4  dm0026  . . . . . . Stata tip 39: In a list or out? In a range or out?
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
Q4/06   SJ 6(4):593--595                                 (no commands)
tip for use of inlist() and inrange()

Nick

On Tue, Sep 11, 2012 at 4:43 AM, Shan Ghimire <shanmire@hotmail.com> wrote:

> I have a panel data on 'X', say i=100 and t=5, giving N = 500, with mean=18 and sd = 4. Now, I want to create a dummy variable 'Y' for each observation where Y =1 {if the observation 'X' is within 1 standard deviation from the mean of X}, otherwise give it a value 0.

*
*   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/
```