Download delabel.sas delabel.sasSubmit a comment

/* 951116 Richard A. DeVenezia
 * Remove the labels from all variables in a dataset;
 */

%macro delabel (ds);

  proc contents data=&ds out=__out__;
  run;

  data _null_;
    set __out__;

    if _n_ = 1 then do;
      lib = scan ("&ds",1,'.');
      ds  = scan ("&ds",2,'.');
      if ds = '' then do;
        ds=lib;
        lib='WORK';
      end;

      call execute ('proc datasets nolist lib=' || lib || ';');
      call execute ('modify ' || ds || ';');
    end;

    call execute ('label ' || name || '=" ";');
  run;

  proc datasets nolist lib=work;
    delete __out__;
  quit;

%mend;