Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Shan Ghimire <shanmire@hotmail.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | RE: st: Create a Dummy Based on Standard Deviation |
Date | Tue, 11 Sep 2012 22:43:21 -0400 |
Thank you Nick. That works for what I was trying to accomplish. Shan ---------------------------------------- > Date: Tue, 11 Sep 2012 07:47:10 +0100 > Subject: Re: st: Create a Dummy Based on Standard Deviation > From: njcoxstata@gmail.com > To: statalist@hsphsun2.harvard.edu > > 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) > > See also > > 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/ * * 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/