Purpose
Gets variable type from a supplied list

%macro generate_typelist(indata=,varlist=);
%let types = ;
/*open dataset*/
%let dsid=%sysfunc(open(&indata.,i));
%if &dsid=0 %then %do;
 
%put %sysfunc(sysmsg());
%end;
%else %do;
/*find out type of variables in varlist and put them in a list*/
 
%do i=1 %to %wordcount(list=&varlist);
   
%let varname = %scan(&varlist,&i);
   
%let varnum = %sysfunc(varnum(&dsid,&varname));
   
%let types = &types %sysfunc(vartype(&dsid,&varnum));
 
%end;
 
%let dsid=%sysfunc(close(&dsid));
%end;
&types;
%mend;