|
On Wed, Aug 6, 2008 at 4:54 PM, <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
>
The use of hash object very easily filters the variable names meeting the
cut_value( in this case, 50).
%let fname = sashelp.class;
%let cut_value = 50;
data _null_;
length varname $ 32;
if _n_ = 1 then do;
declare hash h();
h.definekey('varname');
h.definedata('varname');
h.definedone();
end;
do until(eof);
set &fname end = eof;
array k _numeric_;
do over k;
if k > &cut_value then do;
varname = vname(k);
if h.find() ne 0 then h.add();
end;
end;
end;
h.output(dataset:"&fname." || '_Over' || "&cut_value");
stop;
run;
Output of the dataset:
Obs varname
1 Weight
2 Height
This can be adapted to deal with a set of filenames as well as differing
cut_values.
Muthia Kachirayan
|