SASUnit Examples  Version 1.2.1
_sasunit_existvar.sas
Go to the documentation of this file.
1 
25 %MACRO _sasunit_existVar (
26  i_data
27  ,i_var
28  ,i_vartype
29 );
30 
31 %LOCAL dsid varnum;
32 %LET dsid=%sysfunc(open(&i_data,i));
33 %IF &dsid EQ 0 %THEN 0;
34 %ELSE %DO;
35  %LET varnum=%sysfunc(varnum(&dsid,&i_var));
36  %IF &varnum LE 0 %THEN 0;
37  %ELSE
38  %IF &i_vartype NE
39  AND %sysfunc(vartype(&dsid,&varnum)) NE %upcase(&i_vartype)
40  %THEN 0;
41  %ELSE 1;
42  %LET dsid = %sysfunc(close(&dsid));
43 %END;
44 %MEND _sasunit_existVar;