Published on :

Table label retrieval macro

This code is also available in: Deutsch Español Français
This macro, `dslabel`, is designed as a utility function. It takes a SAS© table name as a parameter (`ds`) and uses the `%attrc` sub-macro (assumed to be available in the SAS© environment) to extract and return the label associated with that table. Its primary purpose is metadata extraction, and it does not perform any data processing.
Data Analysis

Type : EXTERNE


The macro expects a SAS table name (`ds`) as input. The origin of this table (internal, SASHELP, external) is not managed or specified by the macro itself, but by the calling environment. The macro simply reads the metadata of this table.

1 Code Block
Instruction %PUT
Explanation :
This instruction writes a message to the SAS log, indicating that the `dslabel` macro has been called and specifying its version. This is a common practice for debugging or tracking macro execution.
Copied!
1%put MACRO CALLED: dslabel v1.0;
2 Code Block
Définition de la macro dslabel
Explanation :
This is the definition of the `dslabel` macro. It takes a positional argument `ds`, which represents the name of a SAS table. Inside the macro, it calls the `%attrc` sub-macro, passing the table name (`&ds`) and the `label` attribute. The `%attrc` macro is responsible for retrieving the value of the 'label' attribute for the specified table and returning it. The `dslabel` macro is therefore a simple wrapper facilitating access to this functionality.
Copied!
1%macro dslabel(ds);
2%attrc(&ds,label)
3%mend dslabel;
4 
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : This is public domain software. No guarantee as to suitability or accuracy is given or implied. User uses this code entirely at their own risk.