Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mf_getattrc.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Returns a character attribute of a dataset.
4 @details Can be used in open code, eg as follows:
5
6 %put Dataset label = %mf_getattrc(sashelp.class,LABEL);
7 %put Member Type = %mf_getattrc(sashelp.class,MTYPE);
8
9 @param [in] libds library.dataset
10 @param [in] attr full list in [documentation](
11 https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000147794.htm)
12 @return output returns result of the attrc value supplied, or -1 and log
13 message if err.
14
15 @version 9.2
16 @author Allan Bowe
17**/
18
19%macro mf_getattrc(
20 libds
21 ,attr
22)/*/STORE SOURCE*/;
23 %local dsid rc;
24 %let dsid=%sysfunc(open(&libds,is));
25 %if &dsid = 0 %then %do;
26 %put %str(WARN)ING: Cannot open %trim(&libds), system message below;
27 %put %sysfunc(sysmsg());
28 -1
29 %end;
30 %else %do;
31 %sysfunc(attrc(&dsid,&attr))
32 %let rc=%sysfunc(close(&dsid));
33 %end;
34%mend mf_getattrc;