Macros for SAS Application Developers
https://github.com/sasjs/core
mf_getxengine.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Returns the engine type of a SAS fileref
4  @details Queries sashelp.vextfl to get the xengine value.
5  Usage:
6 
7  filename feng temp;
8  %put %mf_getxengine(feng);
9 
10  returns:
11  > TEMP
12 
13  @param [in] fref The fileref to check
14 
15  @returns The XENGINE value in sashelp.vextfl or 0 if not found.
16 
17  @version 9.2
18  @author Allan Bowe
19 
20  <h4> Related Macros </h4>
21  @li mf_getengine.sas
22 
23 **/
24 
25 %macro mf_getxengine(fref
26 )/*/STORE SOURCE*/;
27  %local dsid engnum rc engine;
28 
29  %let dsid=%sysfunc(
30  open(sashelp.vextfl(where=(fileref="%upcase(&fref)")),i)
31  );
32  %if (&dsid ^= 0) %then %do;
33  %let engnum=%sysfunc(varnum(&dsid,XENGINE));
34  %let rc=%sysfunc(fetch(&dsid));
35  %let engine=%sysfunc(getvarc(&dsid,&engnum));
36  %* put &fref. ENGINE is &engine.;
37  %let rc= %sysfunc(close(&dsid));
38  %end;
39  %else %let engine=0;
40 
41  &engine
42 
43 %mend mf_getxengine;