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
@sasjslint {"maxLineLength": 101}
18
**/
19
20
%macro mf_getattrc(
21
libds
22
,attr
23
)
/*/STORE SOURCE*/
;
24
%local dsid rc;
25
%let dsid=%sysfunc(open(&libds,is));
26
%
if
&dsid = 0 %then %
do
;
27
%put %str(WARN)ING: Cannot open %trim(&libds), system message below;
28
%put %sysfunc(sysmsg());
29
-1
30
%end;
31
%
else
%
do
;
32
%sysfunc(attrc(&dsid,&attr))
33
%let rc=%sysfunc(close(&dsid));
34
%end;
35
%mend mf_getattrc;
base
mf_getattrc.sas
Generated by
1.15.0
For more information visit the
Macro Core library
.