Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
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. A fileref that has a row there
16 but no XENGINE value - including a fileref that is not assigned - returns
17 an empty string; 0 is returned only when sashelp.vextfl cannot be opened.
18
19 @version 9.2
20 @author Allan Bowe
21
22 <h4> Related Macros </h4>
23 @li mf_getengine.sas
24
25**/
26
27%macro mf_getxengine(fref
28)/*/STORE SOURCE*/;
29 %local dsid engnum rc engine;
30
31 %let dsid=%sysfunc(
32 open(sashelp.vextfl(where=(fileref="%upcase(&fref)")),i)
33 );
34 %if (&dsid ^= 0) %then %do;
35 %let engnum=%sysfunc(varnum(&dsid,XENGINE));
36 %let rc=%sysfunc(fetch(&dsid));
37 %let engine=%sysfunc(getvarc(&dsid,&engnum));
38 %* put &fref. ENGINE is &engine.;
39 %let rc= %sysfunc(close(&dsid));
40 %end;
41 %else %let engine=0;
42
43 &engine
44
45%mend mf_getxengine;