SASUnit Examples  Version 1.2
getvars.sas
Go to the documentation of this file.
1 
23 %MACRO getvars(
24  data
25  ,dlm=
26 );
27 %local varlist dsid i;
28 %if "&dlm"="" %then %let dlm=%str( );
29 %let dsid = %sysfunc(open(&data));
30 %if &dsid %then %do ;
31  %do i=1 %to %sysfunc(attrn(&dsid,NVARS));
32  %if &i=1 %then
33  %let varlist = %sysfunc(varname(&dsid,&i));
34  %else
35  %let varlist = &varlist.&dlm.%sysfunc(varname(&dsid,&i));
36  %end;
37  %let dsid = %sysfunc(close(&dsid));
38 %end;
39 &varlist
40 %MEND getvars;