On Wed, Aug 6, 2008 at 4:54 PM, <firstname.lastname@example.org> 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?
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;
length varname $ 32;
if _n_ = 1 then do;
declare hash h();
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();
h.output(dataset:"&fname." || '_Over' || "&cut_value");
Output of the dataset:
This can be adapted to deal with a set of filenames as well as differing