Date: Thu, 17 Apr 2008 16:02:24 -0500
Reply-To: "data _null_," <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_," <datanull@GMAIL.COM>
Subject: Re: data step questions
In-Reply-To: <200804172031.m3HG95Hj001961@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
data test;
input id:$2. var1-var7;
has1 = not not indexW(catx(',',of var:),'1',',');
cards;
aa 2 8 9 4 8 9 0
bb 7 1 2 5 . 0 12
cc 0 2 1 9 10 100 1000
dd 10 100 0 -1 10 100 1000
;;;;
run;
proc print;
run;
On Thu, Apr 17, 2008 at 3:31 PM, Jane <program.sas@gmail.com> wrote:
> Hi all
>
> I have a stupid question. If I have a lot of variables, like:
>
> var1 var2.....var30.
>
> If any of them equal to 1, I want to pull out that row. Just like:
>
> id var1 var2 var3 var4 var5 var6 var7...
> aa 2 8 9 4 8 9 0
> bb 7 1 2 5 . 0 12
> cc 0 2 1 ....................
>
> Then I can get the dataset like:
> id
> ----
> bb
> cc
>
> How can I do this in some simple way? I do not need to use "if..then.." for
> 30 variables.
>
> Thank you very much!
> Jane
>
|