|
add a trim to mtrm==>
if upcase(substr(left(temp),1,4))="MRTM" then mtrm = trim(mtrm) || ' '
|| vname(vars(i));
You can also use SCL function in datastep (look after functions: open,
attrn, varname, close).
or the SASHELP.VCOLUMN view.
or ODS with proc contents
or proc contents...
Xavier
Janis.Jekabsons@dresdner-bank.com (Janis Jekabsons) wrote in message news:<f6ed644e.0306240241.16875a34@posting.google.com>...
> Hi group,
>
> I would like to get the names of all variables ending in "MTRM" using
> something like this:
>
> data _null_;
> set &_pricedat;
> length mtrm $200.;
> mtrm='';
> if _n_=1 then do;
> array vars(*) _numeric_;
> do i=1 to dim(vars);
> temp=reverse(vname(vars(i)));
> put temp=;
> if upcase(substr(left(temp),1,4))="MRTM" then mtrm = mtrm || ' '
> || vname(vars(i));
> put mtrm= ;
> end;
> call symput('mtrm',mtrm);
> end;
> if _n_ ge 1 then stop;
> run;
>
> %put MTMR = &MTRM;
>
> The weak point appears to be the assignment
> mtrm = mtrm || ' ' || vname(vars(i));
>
> MTRM comes back empty, even though the decision (upcase ..) works.
>
> How can I do this? I am probably missing something quite simple ...
>
> Regards,
>
> Janis Jekabsons
|