in [SAS]

From: greenwillow on 16 Jul 2010 15:13 I have more than 30 variables. I need to select out the observations which have at least one variable larger than 3(cutoff point). I know I can write as if var1>3 or var2>3 or.................or var30>3; to select out the observations. Is there an easier way to do this?
From: Ya on 16 Jul 2010 15:15 On Jul 16, 12:13 pm, greenwillow <yangliuy... (a)gmail.com> wrote:> I have more than 30 variables. I need to select out the observations > which have at least one variable larger than 3(cutoff point). > > I know I can write as if var1>3 or var2>3 or.................or > var30>3; to select out the observations. > > Is there an easier way to do this? Try max() function: if max(of var1-var10) > 3; HTH Ya
From: greenwillow on 16 Jul 2010 15:17 thank you Ya. But what can I do if the variable names doesn't have a common index. The variables names are more like aa1bb, aa2bb, .... On Jul 16, 2:15 pm, Ya <huang8... (a)gmail.com> wrote:> On Jul 16, 12:13 pm, greenwillow <yangliuy... (a)gmail.com> wrote:> > > I have more than 30 variables. I need to select out the observations > > which have at least one variable larger than 3(cutoff point). > > > I know I can write as if var1>3 or var2>3 or.................or > > var30>3; to select out the observations. > > > Is there an easier way to do this? > > Try max() function: > > if max(of var1-var10) > 3; > > HTH > > Ya
From: Ya on 16 Jul 2010 15:42 On Jul 16, 12:17 pm, greenwillow <yangliuy... (a)gmail.com> wrote:> thank you Ya. But what can I do if the variable names doesn't have a > common index. The variables names are more like aa1bb, aa2bb, .... > > On Jul 16, 2:15 pm, Ya <huang8... (a)gmail.com> wrote:> > > > > On Jul 16, 12:13 pm, greenwillow <yangliuy... (a)gmail.com> wrote:> > > > I have more than 30 variables. I need to select out the observations > > > which have at least one variable larger than 3(cutoff point). > > > > I know I can write as if var1>3 or var2>3 or.................or > > > var30>3; to select out the observations. > > > > Is there an easier way to do this? > > > Try max() function: > > > if max(of var1-var10) > 3; > > > HTH > > > Ya- Hide quoted text - > > - Show quoted text - if you have limited number of variables, simply type in with comma as delimiter: if max(aa1bb,aa2bb,...) > 3; or if all your vars are numeric, you can something like this: if max(of _numeric_) > 3; If you have many numeric vars that should be be included, then you may have to construct the list of var using meta data. HTH Ya
From: mahi on 18 Jul 2010 14:48
On Jul 16, 3:42 pm, Ya <huang8... (a)gmail.com> wrote:> On Jul 16, 12:17 pm, greenwillow <yangliuy... (a)gmail.com> wrote:> > > > > > > thank you Ya. But what can I do if the variable names doesn't have a > > common index. The variables names are more like aa1bb, aa2bb, .... > > > On Jul 16, 2:15 pm, Ya <huang8... (a)gmail.com> wrote:> > > > On Jul 16, 12:13 pm, greenwillow <yangliuy... (a)gmail.com> wrote:> > > > > I have more than 30 variables. I need to select out the observations > > > > which have at least one variable larger than 3(cutoff point). > > > > > I know I can write as if var1>3 or var2>3 or.................or > > > > var30>3; to select out the observations. > > > > > Is there an easier way to do this? > > > > Try max() function: > > > > if max(of var1-var10) > 3; > > > > HTH > > > > Ya- Hide quoted text - > > > - Show quoted text - > > if you have limited number of variables, simply type in with comma as > delimiter: > > if max(aa1bb,aa2bb,...) > 3; > > or if all your vars are numeric, you can something like this: > > if max(of _numeric_) > 3; > > If you have many numeric vars that should be be included, then you may > have > to construct the list of var using meta data. > > HTH > > Ya is there any way we can use array here... |