/* Macro sas_vars (modified by F. Harrell 30Jan90, Bill Dunlap Dec90,
         F. Harrell Jul92)
    Returns list of variables in format readable Splus

    Arguments:
	dataset - name of SAS dataset
	temp1	- Name of temporary dataset to contain data dictionary 		  	  	  (unquoted)
		  default=/tmp/file.1
                                                                              */
%macro sas_vars(dataset,  temp1);
%IF %QUOTE(&temp1)=  %THEN %LET temp1=/tmp/file.1;
%LET _s_=_sav_;
proc contents data=&dataset out=&_s_(KEEP=name type length label format nobs 
 varnum) noprint; 
PROC SORT DATA=&_s_;BY varnum;

data _null_; set &_s_;
 retain __delim 18 _bk_ -1; 
 file "&temp1";
 name=TRANSLATE(name,".abcdefghijklmnopqrstuvwxyz",
		     ".ABCDEFGHIJKLMNOPQRSTUVWXYZ");
 put name +_bk_ __delim IB1. type __delim IB1. length __delim IB1.
  format __delim IB1. label +_bk_ __delim IB1. nobs __delim IB1.;
*FH added +_bk_ after name 31Jul92;

run;
%mend sas_vars;
