filename outfile '{ob external-file}';
%macro delim(lib,dsn,out);

proc contents data=&lib..&dsn
               out=_temp_(keep=name type npos) noprint;
run;

proc sort data=_temp_;
   by npos;
run;

data _null_;
   set _temp_ end=eof;
   call symput('var'||(left(put(_n_,5.))),name);
   call symput('typ'||(left(put(_n_,5.))),
                         left(put(type,8.)));
   if eof then
      call symput('total',left(put(_n_,8.)));
run;

data _null_;
   file &out noprint;
   set &lib..&dsn;
   format _numeric_ best12.;
   put
   %do i=1 %to &total;
      %if &&typ&i=1 %then %do;   /* if numeric variable               */
         &&var&i +(-1) ','
      %end;
      %else %do;                 /* if character variable             */
          "'" &&var&i +(-1) "',"
      %end;
   %end;
   +(-1) ' ';                    /* remove the extra comma at the end */
run;

%mend delim;

%delim(sasuser,houses,outfile)