Date: Wed, 6 Aug 2008 17:36:29 -0400
Reply-To: Ya Huang <ya.huang@AMYLIN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ya Huang <ya.huang@AMYLIN.COM>
Subject: Re: hundreds of variables, which variables have values over 1500
The following code will search all datasets in WORK and the numeric
variables with value > 104, then dump the result in a text file:
data x1;
set sashelp.class;
run;
data x2;
set sashelp.class;
age=age*7;
run;
filename find "c:\temp\junk.txt";
data _null_;
set sashelp.vtable (where=(libname='WORK'));
call execute('data _null_;');
call execute('set '||memname||';');
call execute('file find mod;');
call execute('array num _numeric_;');
call execute('do over num;');
call execute('_name=vname(num);');
call execute('if num > 104 then put "file '||trim(memname)||' " _name
num;');
call execute('end; run;');
run;
file X1 Weight 112.5
file X1 Weight 112.5
file X1 Weight 112
file X1 Weight 150
file X1 Weight 128
file X1 Weight 133
file X1 Weight 112
file X2 Weight 112.5
file X2 Age 105
file X2 Weight 112.5
file X2 Age 105
file X2 Weight 112
file X2 Age 112
file X2 Weight 150
file X2 Weight 128
file X2 Age 105
file X2 Weight 133
file X2 Age 105
file X2 Weight 112
On Wed, 6 Aug 2008 13:54:26 -0700, jensen.emily@GMAIL.COM wrote:
>I have hundreds of files and each file has hunderds of variables. I
>read them in using a pipe and macros.
>
>My problem is I need to see which variables have values over 1500.
>How would I code it to look at all the variables in a certain file and
>show me the variables that have values over 1500?
>
>Thanks
>Emily